Browse Source

Feature/add missing database indexes (#3026)

* Add missing database indexes

* Update changelog
pull/3027/head
Thomas Kaul 8 months ago
committed by GitHub
parent
commit
93de25e5b6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      CHANGELOG.md
  2. 11
      prisma/migrations/20240219182116_added_missing_indexes/migration.sql
  3. 5
      prisma/schema.prisma

8
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

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

5
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 {

Loading…
Cancel
Save