diff --git a/CHANGELOG.md b/CHANGELOG.md index fae4b3527..a52b07c44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Added an index for `id` to the account database table +- Added indexes for `dataSource` and `date` to the market data database table +- Added an index for `accountId` to the order database table + ## 2.53.1 - 2024-02-18 ### Added diff --git a/prisma/migrations/20240219182116_added_missing_indexes/migration.sql b/prisma/migrations/20240219182116_added_missing_indexes/migration.sql new file mode 100644 index 000000000..a18639489 --- /dev/null +++ b/prisma/migrations/20240219182116_added_missing_indexes/migration.sql @@ -0,0 +1,11 @@ +-- CreateIndex +CREATE INDEX "Account_id_idx" ON "Account"("id"); + +-- CreateIndex +CREATE INDEX "MarketData_dataSource_idx" ON "MarketData"("dataSource"); + +-- CreateIndex +CREATE INDEX "MarketData_date_idx" ON "MarketData"("date"); + +-- CreateIndex +CREATE INDEX "Order_accountId_idx" ON "Order"("accountId"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 615610fa3..ae36b00bf 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -39,6 +39,7 @@ model Account { Order Order[] @@id([id, userId]) + @@index([id]) } model AccountBalance { @@ -81,6 +82,8 @@ model MarketData { symbol String @@unique([dataSource, date, symbol]) + @@index([dataSource]) + @@index([date]) @@index([symbol]) } @@ -103,6 +106,8 @@ model Order { SymbolProfile SymbolProfile @relation(fields: [symbolProfileId], references: [id]) User User @relation(fields: [userId], references: [id]) tags Tag[] + + @@index([accountId]) } model Platform {