diff --git a/CHANGELOG.md b/CHANGELOG.md index f268e4db3..12e1a3e0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 -Fixed the data source of the _Fear & Greed Index_ (market mood) +### Todo + +- Apply data migration (`yarn database:migrate`) + ## 1.109.0 - 01.02.2022 ### Added diff --git a/prisma/migrations/20220202192001_changed_data_source_to_optional_in_order/migration.sql b/prisma/migrations/20220202192001_changed_data_source_to_optional_in_order/migration.sql new file mode 100644 index 000000000..56d3d0442 --- /dev/null +++ b/prisma/migrations/20220202192001_changed_data_source_to_optional_in_order/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Order" ALTER COLUMN "dataSource" DROP NOT NULL; diff --git a/prisma/migrations/20220202192041_changed_symbol_to_optional_in_order/migration.sql b/prisma/migrations/20220202192041_changed_symbol_to_optional_in_order/migration.sql new file mode 100644 index 000000000..4a077e004 --- /dev/null +++ b/prisma/migrations/20220202192041_changed_symbol_to_optional_in_order/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Order" ALTER COLUMN "symbol" DROP NOT NULL; diff --git a/prisma/migrations/20220202192216_changed_symbol_profile_to_required_in_order/migration.sql b/prisma/migrations/20220202192216_changed_symbol_profile_to_required_in_order/migration.sql new file mode 100644 index 000000000..6caf8c08f --- /dev/null +++ b/prisma/migrations/20220202192216_changed_symbol_profile_to_required_in_order/migration.sql @@ -0,0 +1,8 @@ +-- DropForeignKey +ALTER TABLE "Order" DROP CONSTRAINT "Order_symbolProfileId_fkey"; + +-- AlterTable +ALTER TABLE "Order" ALTER COLUMN "symbolProfileId" SET NOT NULL; + +-- AddForeignKey +ALTER TABLE "Order" ADD CONSTRAINT "Order_symbolProfileId_fkey" FOREIGN KEY ("symbolProfileId") REFERENCES "SymbolProfile"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 0c89f8ec5..2625c0fcd 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -70,24 +70,24 @@ model MarketData { } model Order { - Account Account? @relation(fields: [accountId, accountUserId], references: [id, userId]) + Account Account? @relation(fields: [accountId, accountUserId], references: [id, userId]) accountId String? accountUserId String? - createdAt DateTime @default(now()) + createdAt DateTime @default(now()) currency String? - dataSource DataSource + dataSource DataSource? date DateTime fee Float - id String @default(uuid()) - isDraft Boolean @default(false) + id String @default(uuid()) + isDraft Boolean @default(false) quantity Float - symbol String - SymbolProfile SymbolProfile? @relation(fields: [symbolProfileId], references: [id]) - symbolProfileId String? + symbol String? + SymbolProfile SymbolProfile @relation(fields: [symbolProfileId], references: [id]) + symbolProfileId String type Type unitPrice Float - updatedAt DateTime @updatedAt - User User @relation(fields: [userId], references: [id]) + updatedAt DateTime @updatedAt + User User @relation(fields: [userId], references: [id]) userId String @@id([id, userId])