From 573038f407d712c8d15cd1a8e1cdc31c5584d4eb Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 9 Aug 2022 19:31:13 +0200 Subject: [PATCH] Feature/add default values for countries and sectors (#1133) * Add default values * Add database validation script * Update changelog --- CHANGELOG.md | 1 + package.json | 1 + .../migration.sql | 2 ++ .../migration.sql | 2 ++ prisma/schema.prisma | 4 ++-- 5 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 prisma/migrations/20220808191912_added_default_value_for_countries_of_symbol_profile_overrides/migration.sql create mode 100644 prisma/migrations/20220808192002_added_default_value_for_sectors_of_symbol_profile_overrides/migration.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 90bb3a275..03ee8091b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added `url` to the symbol profile overrides model for manual adjustments +- Added default values for `countries` and `sectors` of the symbol profile overrides model ### Changed diff --git a/package.json b/package.json index 6791763c9..c3e1e9b2a 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "database:push": "prisma db push", "database:seed": "prisma db seed", "database:setup": "yarn database:push && yarn database:seed && yarn database:baseline", + "database:validate": "prisma validate", "dep-graph": "nx dep-graph", "e2e": "ng e2e", "format": "nx format:write", diff --git a/prisma/migrations/20220808191912_added_default_value_for_countries_of_symbol_profile_overrides/migration.sql b/prisma/migrations/20220808191912_added_default_value_for_countries_of_symbol_profile_overrides/migration.sql new file mode 100644 index 000000000..3b1702f10 --- /dev/null +++ b/prisma/migrations/20220808191912_added_default_value_for_countries_of_symbol_profile_overrides/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "SymbolProfileOverrides" ALTER COLUMN "countries" SET DEFAULT '[]'; diff --git a/prisma/migrations/20220808192002_added_default_value_for_sectors_of_symbol_profile_overrides/migration.sql b/prisma/migrations/20220808192002_added_default_value_for_sectors_of_symbol_profile_overrides/migration.sql new file mode 100644 index 000000000..3b11db82d --- /dev/null +++ b/prisma/migrations/20220808192002_added_default_value_for_sectors_of_symbol_profile_overrides/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "SymbolProfileOverrides" ALTER COLUMN "sectors" SET DEFAULT '[]'; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 12eb5690d..6009f4544 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -133,9 +133,9 @@ model SymbolProfile { model SymbolProfileOverrides { assetClass AssetClass? assetSubClass AssetSubClass? - countries Json? + countries Json? @default("[]") name String? - sectors Json? + sectors Json? @default("[]") url String? symbolProfileId String @id updatedAt DateTime @updatedAt