This commit is contained in:
2023-04-20 00:08:43 +00:00
parent cb4311403a
commit b301b907b3
5 changed files with 228 additions and 7 deletions

View File

@@ -20,18 +20,18 @@ namespace Sockeye.Util
/////////// CHANGE THIS ON NEW SCHEMA UPDATE ////////////////////
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 19;
private const int DESIRED_SCHEMA_LEVEL = 22;
internal const long EXPECTED_COLUMN_COUNT = 549;
internal const long EXPECTED_COLUMN_COUNT = 553;
internal const long EXPECTED_INDEX_COUNT = 77;
internal const long EXPECTED_CHECK_CONSTRAINTS = 264;
internal const long EXPECTED_CHECK_CONSTRAINTS = 267;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 40;
internal const long EXPECTED_VIEWS = 0;
internal const long EXPECTED_ROUTINES = 2;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
///////////////////////////////////////// (C549:I77:CC264:FC40:V0:R2)
///////////////////////////////////////// C553:I77:CC267:FC40:V0:R2
/*
MAXIMUM POSTGRES OBJECT NAME LENGTH: 63 CHARACTERS
@@ -1609,6 +1609,61 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
}
//////////////////////////////////////////////////
//
// reporting for subscriptions required data
//
if (currentSchema < 20)
{
LogUpdateMessage(log);
await ExecQueryAsync("ALTER TABLE aproduct ADD column initialprice DECIMAL(38,18) NOT NULL default 0");
await ExecQueryAsync("ALTER TABLE aproduct ADD column renewprice DECIMAL(38,18) NOT NULL default 0");
await SetSchemaLevelAsync(++currentSchema);
}
if (currentSchema < 21)
{
LogUpdateMessage(log);
await ExecQueryAsync("ALTER TABLE asubscriptionitem ADD column renewal BOOL NOT NULL DEFAULT true");
//english translations
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'InitialPrice', 'Initial price' FROM atranslation t where t.baselanguage = 'en'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'RenewPrice', 'Renewal price' FROM atranslation t where t.baselanguage = 'en'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Renewal', 'Renewal' FROM atranslation t where t.baselanguage = 'en'");
//spanish translations
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'InitialPrice', 'Initial price' FROM atranslation t where t.baselanguage = 'es'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'RenewPrice', 'Renewal price' FROM atranslation t where t.baselanguage = 'es'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Renewal', 'Renewal' FROM atranslation t where t.baselanguage = 'es'");
//french translations
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'InitialPrice', 'Initial price' FROM atranslation t where t.baselanguage = 'fr'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'RenewPrice', 'Renewal price' FROM atranslation t where t.baselanguage = 'fr'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Renewal', 'Renewal' FROM atranslation t where t.baselanguage = 'fr'");
//german translations
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'InitialPrice', 'Initial price' FROM atranslation t where t.baselanguage = 'de'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'RenewPrice', 'Renewal price' FROM atranslation t where t.baselanguage = 'de'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Renewal', 'Renewal' FROM atranslation t where t.baselanguage = 'de'");
await SetSchemaLevelAsync(++currentSchema);
}
if (currentSchema < 22)
{
LogUpdateMessage(log);
await ExecQueryAsync("ALTER TABLE asubscriptionitem ADD column tags VARCHAR(255) ARRAY ");
await SetSchemaLevelAsync(++currentSchema);
}
//#########################################
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!