This commit is contained in:
2022-03-06 16:08:44 +00:00
parent cc69f6b3d3
commit 5eab2c43bd
3 changed files with 26 additions and 11 deletions

View File

@@ -22,17 +22,16 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 1;
internal const long EXPECTED_COLUMN_COUNT = 1336;
internal const long EXPECTED_COLUMN_COUNT = 1341;
internal const long EXPECTED_INDEX_COUNT = 154;
internal const long EXPECTED_CHECK_CONSTRAINTS = 527;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 198;
internal const long EXPECTED_CHECK_CONSTRAINTS = 532;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 199;
internal const long EXPECTED_VIEWS = 11;
internal const long EXPECTED_ROUTINES = 2;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
///////////////////////////////////////// (C1336:I154:CC527:FC198:V11:R2
///////////////////////////////////////// C1341:I154:CC532:FC199:V11:R2)
/*
@@ -1184,8 +1183,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//VIEWWORKORDER - adds AGE expression column for datalist queries
//do *not* use the postgre AGE function, it's not intended for code use: https://github.com/npgsql/efcore.pg/issues/2157
// await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, AGE(timezone('UTC', now()), aworkorder.createddate) as expwoage from aworkorder");
await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, now() - aworkorder.createddate as expwoage from aworkorder");
// await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, AGE(timezone('UTC', now()), aworkorder.createddate) as expwoage from aworkorder");
await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, now() - aworkorder.createddate as expwoage from aworkorder");
//NOTIFICATION
await ExecQueryAsync("CREATE TABLE anotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "
@@ -1207,7 +1206,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//CUSTOMER "proxy" NOTIFICATION
await ExecQueryAsync("CREATE TABLE acustomernotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "
await ExecQueryAsync("CREATE TABLE acustomernotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "
+ "translationid BIGINT NOT NULL REFERENCES atranslation (id) NOT NULL, languageoverride TEXT NOT NULL, timezoneoverride TEXT NOT NULL, "
+ "currencyname TEXT NOT NULL, hour12 BOOL NOT NULL, "
+ "customertags VARCHAR(255) ARRAY, ayatype INTEGER NOT NULL, eventtype INTEGER NOT NULL, advancenotice INTERVAL NOT NULL, "
+ "idvalue BIGINT NOT NULL, decvalue DECIMAL(38,18) NOT NULL, agevalue INTERVAL NOT NULL, "
+ "linkreportid BIGINT, tags VARCHAR(255) ARRAY)");
@@ -1215,6 +1216,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//UNITMETERREADING
await ExecQueryAsync("CREATE TABLE aunitmeterreading (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, meterdate TIMESTAMPTZ NOT NULL, notes TEXT, "
+ "meter BIGINT NOT NULL, unitid BIGINT NOT NULL REFERENCES aunit(id) ON DELETE CASCADE, workorderitemunitid BIGINT REFERENCES aworkorderitemunit(id) ON DELETE SET NULL)");