Feature/add missing database indexes (#3026)

* Add missing database indexes

* Update changelog
pull/3027/head
Thomas Kaul 10 months ago committed by GitHub
parent 9acdb41aa2
commit 93de25e5b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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/), 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). 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 ## 2.53.1 - 2024-02-18
### Added ### Added

@ -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");

@ -39,6 +39,7 @@ model Account {
Order Order[] Order Order[]
@@id([id, userId]) @@id([id, userId])
@@index([id])
} }
model AccountBalance { model AccountBalance {
@ -81,6 +82,8 @@ model MarketData {
symbol String symbol String
@@unique([dataSource, date, symbol]) @@unique([dataSource, date, symbol])
@@index([dataSource])
@@index([date])
@@index([symbol]) @@index([symbol])
} }
@ -103,6 +106,8 @@ model Order {
SymbolProfile SymbolProfile @relation(fields: [symbolProfileId], references: [id]) SymbolProfile SymbolProfile @relation(fields: [symbolProfileId], references: [id])
User User @relation(fields: [userId], references: [id]) User User @relation(fields: [userId], references: [id])
tags Tag[] tags Tag[]
@@index([accountId])
} }
model Platform { model Platform {

Loading…
Cancel
Save