case 4504

This commit is contained in:
2023-04-13 23:01:03 +00:00
parent 68e181a085
commit be4e0e2ad3
2 changed files with 115 additions and 8 deletions

View File

@@ -19,7 +19,7 @@ namespace Sockeye.Models
public bool Active { get; set; }
[Required]
public ProductGroup PGroup { get; set; }
public long? CustomerId { get; set; }
public long CustomerId { get; set; }
[NotMapped]
public string CustomerViz { get; set; }

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 = 18;
private const int DESIRED_SCHEMA_LEVEL = 19;
internal const long EXPECTED_COLUMN_COUNT = 531;
internal const long EXPECTED_INDEX_COUNT = 75;
internal const long EXPECTED_CHECK_CONSTRAINTS = 252;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 37;
internal const long EXPECTED_COLUMN_COUNT = 543;
internal const long EXPECTED_INDEX_COUNT = 78;
internal const long EXPECTED_CHECK_CONSTRAINTS = 260;
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!!!!
///////////////////////////////////////// C531:I75:CC252:FC37:V0:R2
///////////////////////////////////////// (C543:I78:CC260:FC40:V0:R2)
/*
MAXIMUM POSTGRES OBJECT NAME LENGTH: 63 CHARACTERS
@@ -1459,7 +1459,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'GlobalRavenTrialRejected', 'Raven trial rejected message' FROM atranslation t where t.baselanguage = 'de'");
currentSchema = 17;
await SetSchemaLevelAsync(currentSchema);
await SetSchemaLevelAsync(++currentSchema);
}
@@ -1492,6 +1492,113 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
}
//////////////////////////////////////////////////
//
// case 4504
//
if (currentSchema < 19)
{
LogUpdateMessage(log);
//SUBSCRIPTION
await ExecQueryAsync("CREATE TABLE asubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, notes TEXT, "
+ "customerid BIGINT REFERENCES acustomer(id) ON DELETE CASCADE, pgroup INTEGER NOT NULL DEFAULT 4, tags VARCHAR(255) ARRAY )");
//SUBSCRIPTIONITEM
await ExecQueryAsync("CREATE TABLE asubscriptionitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, subscriptionid BIGINT NOT NULL REFERENCES asubscription ON DELETE CASCADE, "
+ "productid BIGINT REFERENCES aproduct(id), expiredate TIMESTAMPTZ NOT NULL, quantity INTEGER NOT NULL DEFAULT 1 )");
//english translations
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Subscription', 'Subscription' FROM atranslation t where t.baselanguage = 'en'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionItem', 'SubscriptionItem' FROM atranslation t where t.baselanguage = 'en'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionList', 'Subscriptions' FROM atranslation t where t.baselanguage = 'en'");
//spanish translations
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Subscription', 'Subscription' FROM atranslation t where t.baselanguage = 'es'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionItem', 'SubscriptionItem' FROM atranslation t where t.baselanguage = 'es'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionList', 'Subscriptions' FROM atranslation t where t.baselanguage = 'es'");
//french translations
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Subscription', 'Subscription' FROM atranslation t where t.baselanguage = 'fr'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionItem', 'SubscriptionItem' FROM atranslation t where t.baselanguage = 'fr'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionList', 'Subscriptions' FROM atranslation t where t.baselanguage = 'fr'");
//german translations
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'Subscription', 'Subscription' FROM atranslation t where t.baselanguage = 'de'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionItem', 'SubscriptionItem' FROM atranslation t where t.baselanguage = 'de'");
await ExecQueryAsync("INSERT INTO atranslationitem(translationid,key,display) SELECT t.id, 'SubscriptionList', 'Subscriptions' FROM atranslation t where t.baselanguage = 'de'");
//UPDATED NAME FETCHER
await ExecQueryAsync(@"
CREATE OR REPLACE FUNCTION PUBLIC.AYGETNAME(IN AYOBJECTID BIGINT, IN stype INTEGER,TRANSLATIONID integer) RETURNS TEXT AS $BODY$
DECLARE
aytable TEXT DEFAULT '';
aynamecolumn TEXT DEFAULT 'name';
aytkey TEXT DEFAULT 'no';
returnstr TEXT DEFAULT '';
BEGIN
case stype
when 0 then aytkey= 'NoType';
when 1 then aytkey= 'Global';
when 2 then return 'FormUserOptions';
when 3 then aytable = 'auser';
when 4 then aytkey= 'ServerState';
when 6 then aytkey= 'LogFile';
when 7 then aytkey= 'PickListTemplate';
when 8 then aytable = 'acustomer';
when 9 then aytkey= 'ServerJob';
when 12 then aytkey= 'ServerMetrics';
when 13 then aytable = 'atranslation';
when 14 then aytkey= 'UserOptions';
when 15 then aytable = 'aheadoffice';
when 17 then aytable = 'afileattachment'; aynamecolumn ='displayfilename';
when 18 then aytable = 'adatalistsavedfilter';
when 19 then aytable = 'aformcustom'; aynamecolumn = 'formkey';
when 33 then aytable = 'avendor';
when 47 then aytkey= 'GlobalOps';
when 48 then aytkey= 'BizMetrics';
when 49 then aytkey= 'Backup';
when 50 then aytable = 'ainappnotification';
when 51 then aytkey= 'NotifySubscription';
when 52 then aytable = 'areminder';
when 56 then aytkey= 'OpsNotificationSettings';
when 57 then aytable = 'areport';
when 58 then aytkey= 'DashBoardView';
when 59 then aytable = 'acustomernote'; aynamecolumn = 'notedate';
when 60 then aytable = 'amemo';
when 61 then aytable = 'areview';
when 68 then return format('DataListColumnView %L', ayobjectid);
when 84 then aytkey= 'CustomerNotifySubscription';
when 92 then aytable = 'aintegration';
when 93 then aytable = 'alicense'; aynamecolumn = 'regto';
when 94 then aytable = 'atriallicenserequest'; aynamecolumn = 'companyname';
when 95 then aytable = 'asubscriptionserver';
when 96 then aytable = 'apurchase'; aynamecolumn = 'salesordernumber';
when 97 then aytable = 'aproduct';
when 98 then aytable = 'agzcase';
when 99 then aytable = 'avendornotification';
when 100 then aytable = 'asubscription';
else
RETURN returnstr;
end case;
IF aytkey='no' then
EXECUTE format('SELECT %I FROM %I WHERE id = %L', aynamecolumn, aytable, ayobjectid) INTO returnstr;
else
EXECUTE format('select display from atranslationitem where translationid=%L and key=%L', TRANSLATIONID, aytkey) INTO returnstr;
END if;
RETURN returnstr;
END;
$BODY$ LANGUAGE PLPGSQL STABLE");
currentSchema = 19;
await SetSchemaLevelAsync(++currentSchema);
}
//#########################################
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!