This commit is contained in:
@@ -20,7 +20,7 @@ namespace AyaNova.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 = 3;
|
||||
private const int DESIRED_SCHEMA_LEVEL = 4;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 1359;
|
||||
internal const long EXPECTED_INDEX_COUNT = 156;
|
||||
@@ -361,8 +361,7 @@ $BODY$;
|
||||
");
|
||||
|
||||
|
||||
//Name fetcher function
|
||||
//CoreBizObject ADD here
|
||||
//Original Name fetcher function, superseded by later updates
|
||||
await ExecQueryAsync(@"
|
||||
CREATE OR REPLACE FUNCTION PUBLIC.AYGETNAME(IN AYOBJECTID BIGINT, IN AYATYPE INTEGER,TRANSLATIONID integer) RETURNS TEXT AS $BODY$
|
||||
DECLARE
|
||||
@@ -1328,6 +1327,137 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
}
|
||||
|
||||
|
||||
if (currentSchema < 4)
|
||||
{
|
||||
LogUpdateMessage(log);
|
||||
|
||||
//INTEGRATION
|
||||
await ExecQueryAsync("CREATE TABLE aintegration (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, integrationappid uuid NOT NULL UNIQUE, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, "
|
||||
+ "integrationdata TEXT )");
|
||||
|
||||
//INTEGRATIONITEM
|
||||
await ExecQueryAsync("CREATE TABLE aintegrationitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, integrationid BIGINT NOT NULL REFERENCES aintegration ON DELETE CASCADE, "
|
||||
+ "atype INTEGER NOT NULL, objectid BIGINT NOT NULL, integrationitemid TEXT NOT NULL, lastsync TIMESTAMPTZ, integrationitemdata TEXT "
|
||||
+ ")");
|
||||
|
||||
|
||||
await ExecQueryAsync(@"
|
||||
CREATE OR REPLACE FUNCTION PUBLIC.AYGETNAME(IN AYOBJECTID BIGINT, IN AYATYPE INTEGER,TRANSLATIONID integer) RETURNS TEXT AS $BODY$
|
||||
DECLARE
|
||||
aytable TEXT DEFAULT '';
|
||||
aynamecolumn TEXT DEFAULT 'name';
|
||||
aytkey TEXT DEFAULT 'no';
|
||||
returnstr TEXT DEFAULT '';
|
||||
BEGIN
|
||||
case ayatype
|
||||
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 5 then aytkey= 'License';
|
||||
when 6 then aytkey= 'LogFile';
|
||||
when 7 then aytkey= 'PickListTemplate';
|
||||
when 8 then aytable = 'acustomer';
|
||||
when 9 then aytkey= 'ServerJob';
|
||||
when 10 then aytable = 'acontract';
|
||||
when 11 then aytkey= 'TrialSeeder';
|
||||
when 12 then aytkey= 'ServerMetrics';
|
||||
when 13 then aytable = 'atranslation';
|
||||
when 14 then aytkey= 'UserOptions';
|
||||
when 15 then aytable = 'aheadoffice';
|
||||
when 16 then aytable = 'aloanunit';
|
||||
when 17 then aytable = 'afileattachment'; aynamecolumn ='displayfilename';
|
||||
when 18 then aytable = 'adatalistsavedfilter';
|
||||
when 19 then aytable = 'aformcustom'; aynamecolumn = 'formkey';
|
||||
when 20 then aytable = 'apart';
|
||||
when 21 then aytable = 'apm'; aynamecolumn ='serial';
|
||||
when 22 then aytkey= 'PMItem';
|
||||
when 23 then aytkey= 'WorkOrderItemExpense';
|
||||
when 24 then aytkey= 'WorkOrderItemLabor';
|
||||
when 25 then aytable = 'aproject';
|
||||
when 26 then aytable = 'apurchaseorder'; aynamecolumn = 'serial';
|
||||
when 27 then aytable = 'aquote'; aynamecolumn = 'serial';
|
||||
when 28 then aytkey= 'QuoteItem';
|
||||
when 29 then aytkey= 'WorkOrderItemLoan';
|
||||
when 30 then aytkey= 'WorkOrderItemPart';
|
||||
when 31 then aytable = 'aunit'; aynamecolumn = 'serial';
|
||||
when 32 then aytable = 'aunitmodel'; aynamecolumn = 'name';
|
||||
when 33 then aytable = 'avendor';
|
||||
when 34 then aytable = 'aworkorder'; aynamecolumn = 'serial';
|
||||
when 35 then aytkey= 'WorkOrderItem';
|
||||
when 36 then aytkey= 'WorkOrderItemExpense';
|
||||
when 37 then aytkey= 'WorkOrderItemLabor';
|
||||
when 38 then aytkey= 'WorkOrderItemLoan';
|
||||
when 39 then aytkey= 'WorkOrderItemPart';
|
||||
when 40 then aytkey= 'WorkOrderItemPartRequest';
|
||||
when 41 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 42 then aytkey= 'WorkOrderItemTask';
|
||||
when 43 then aytkey= 'WorkOrderItemTravel';
|
||||
when 44 then aytkey= 'WorkOrderItemUnit';
|
||||
when 45 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 46 then aytkey= 'WorkOrderItemTask';
|
||||
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 53 then aytkey= 'UnitMeterReading';
|
||||
when 54 then aytable = 'acustomerservicerequest';
|
||||
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 62 then aytable = 'aservicerate';
|
||||
when 63 then aytable = 'atravelrate';
|
||||
when 64 then aytable = 'ataxcode';
|
||||
when 65 then aytable = 'apartassembly';
|
||||
when 66 then aytable = 'apartwarehouse';
|
||||
when 67 then aytable = 'apartinventory'; aynamecolumn='description';
|
||||
when 68 then return format('DataListColumnView %L', ayobjectid);
|
||||
when 71 then aytable = 'aworkorderstatus';
|
||||
when 72 then aytable = 'ataskgroup';
|
||||
when 73 then aytkey= 'WorkOrderItemOutsideService';
|
||||
when 74 then aytable = 'aworkorderitempriority';
|
||||
when 75 then aytable = 'aworkorderitemstatus';
|
||||
when 76 then aytkey= 'WorkOrderItemTravel';
|
||||
when 77 then aytkey= 'QuoteItemUnit';
|
||||
when 78 then aytable = 'aquotestatus';
|
||||
when 79 then aytkey= 'WorkOrderItemOutsideService';
|
||||
when 80 then aytkey= 'WorkOrderItemExpense';
|
||||
when 81 then aytkey= 'WorkOrderItemLabor';
|
||||
when 82 then aytkey= 'WorkOrderItemLoan';
|
||||
when 83 then aytkey= 'WorkOrderItemPart';
|
||||
when 84 then aytkey= 'CustomerNotifySubscription';
|
||||
when 85 then aytkey= 'WorkOrderItemScheduledUser';
|
||||
when 86 then aytkey= 'WorkOrderItemTask';
|
||||
when 87 then aytkey= 'WorkOrderItemTravel';
|
||||
when 88 then aytkey= 'WorkOrderItemUnit';
|
||||
when 89 then aytkey= 'WorkOrderItemOutsideService';
|
||||
when 90 then aytkey= 'PartInventoryDataList';
|
||||
when 91 then return 'PartInventoryRequestDataList synthetic unnamed object';
|
||||
when 92 then aytable = 'aintegration';
|
||||
|
||||
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");
|
||||
|
||||
await SetSchemaLevelAsync(++currentSchema);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//#########################################
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||
|
||||
Reference in New Issue
Block a user