This commit is contained in:
2021-01-01 16:40:25 +00:00
parent 31a5d4c0a7
commit c3f475aadf
5 changed files with 51 additions and 30 deletions

View File

@@ -22,7 +22,7 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 15;
internal const long EXPECTED_COLUMN_COUNT = 596;
internal const long EXPECTED_COLUMN_COUNT = 614;
internal const long EXPECTED_INDEX_COUNT = 175;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -714,21 +714,6 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)");
await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (vendorid) REFERENCES avendor(id)");
//UNIT
await ExecQueryAsync("CREATE TABLE aunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
"serial text not null, customerid bigint not null references acustomer(id), parentunitid bigint null references aunit(id), " +
"unitmodelid bigint null references aunitmodel(id), unithasownaddress bool, boughthere bool, purchasedfromvendorid bigint null references avendor(id), " +
"receipt text null, purchaseddate timestamp null, description text null, replacedbyunitid bigint null references aunit(id), " +
"overridemodelwarranty bool, warrantylength integer null, warrantyterms text null, usesbanking bool, metered bool, lifetimewarranty bool, " +
"text1 text null, text2 text null, text3 text null, text4 text null, " +
"CONSTRAINT UNQ_UnitSerialModelId UNIQUE (serial, unitmodelid) " +
" )");
await ExecQueryAsync("CREATE UNIQUE INDEX aunit_serial_id_idx ON aunit (id, serial);");
await ExecQueryAsync("CREATE INDEX aunit_tags ON aunit using GIN(tags)");
//UNITMODEL
await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text null, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
@@ -739,6 +724,20 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("CREATE INDEX aunitmodel_tags ON aunitmodel using GIN(tags)");
//UNIT
await ExecQueryAsync("CREATE TABLE aunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
"serial text not null, customerid bigint not null references acustomer(id), parentunitid bigint null references aunit(id), " +
"unitmodelid bigint null references aunitmodel(id), unithasownaddress bool, boughthere bool, purchasedfromvendorid bigint null references avendor(id), " +
"receipt text null, purchaseddate timestamp null, description text null, replacedbyunitid bigint null references aunit(id), " +
"overridemodelwarranty bool, warrantylength integer null, warrantyterms text null, usesbanking bool, metered bool, lifetimewarranty bool, " +
"text1 text null, text2 text null, text3 text null, text4 text null, " +
"CONSTRAINT UNQ_UnitSerialModelId UNIQUE (serial, unitmodelid) " +
" )");
await ExecQueryAsync("CREATE UNIQUE INDEX aunit_serial_id_idx ON aunit (id, serial);");
await ExecQueryAsync("CREATE INDEX aunit_tags ON aunit using GIN(tags)");
//----------
//WORKORDER