Browse Source

Feature/update database schema of order (#664)

* Add schema migrations

* Update changelog
pull/665/head
Thomas Kaul 3 years ago
committed by GitHub
parent
commit
5000e9c79b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 2
      prisma/migrations/20220202192001_changed_data_source_to_optional_in_order/migration.sql
  3. 2
      prisma/migrations/20220202192041_changed_symbol_to_optional_in_order/migration.sql
  4. 8
      prisma/migrations/20220202192216_changed_symbol_profile_to_required_in_order/migration.sql
  5. 20
      prisma/schema.prisma

4
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) -Fixed the data source of the _Fear & Greed Index_ (market mood)
### Todo
- Apply data migration (`yarn database:migrate`)
## 1.109.0 - 01.02.2022 ## 1.109.0 - 01.02.2022
### Added ### Added

2
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;

2
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;

8
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;

20
prisma/schema.prisma

@ -70,24 +70,24 @@ model MarketData {
} }
model Order { model Order {
Account Account? @relation(fields: [accountId, accountUserId], references: [id, userId]) Account Account? @relation(fields: [accountId, accountUserId], references: [id, userId])
accountId String? accountId String?
accountUserId String? accountUserId String?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
currency String? currency String?
dataSource DataSource dataSource DataSource?
date DateTime date DateTime
fee Float fee Float
id String @default(uuid()) id String @default(uuid())
isDraft Boolean @default(false) isDraft Boolean @default(false)
quantity Float quantity Float
symbol String symbol String?
SymbolProfile SymbolProfile? @relation(fields: [symbolProfileId], references: [id]) SymbolProfile SymbolProfile @relation(fields: [symbolProfileId], references: [id])
symbolProfileId String? symbolProfileId String
type Type type Type
unitPrice Float unitPrice Float
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
User User @relation(fields: [userId], references: [id]) User User @relation(fields: [userId], references: [id])
userId String userId String
@@id([id, userId]) @@id([id, userId])

Loading…
Cancel
Save