This commit is contained in:
2020-11-10 20:29:14 +00:00
parent 1d88ed0778
commit 75be65c871

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 = 417;
internal const long EXPECTED_COLUMN_COUNT = 433;
internal const long EXPECTED_INDEX_COUNT = 144;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -483,21 +483,29 @@ $BODY$;
//CUSTOMER
await ExecQueryAsync("CREATE TABLE acustomer (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY)");
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
"webaddress text, popupnotes text, billheadoffice bool, technotes text, accountnumber text, usesbanking bool, contractexpires timestamp null, " +
"phone1 text, phone2 text, phone3 text, phone4 text, phone5 text, emailaddress text)");
await ExecQueryAsync("CREATE UNIQUE INDEX acustomer_name_id_idx ON acustomer (id, name);");
await ExecQueryAsync("CREATE INDEX acustomer_tags ON acustomer using GIN(tags)");
//CONTRACT
await ExecQueryAsync("CREATE TABLE acontract (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX acontract_name_id_idx ON acontract (id, name);");
await ExecQueryAsync("CREATE INDEX acontract_tags ON acontract using GIN(tags)");
await ExecQueryAsync("ALTER TABLE acustomer add column contractid bigint null references acontract");
//HEADOFFICE
await ExecQueryAsync("CREATE TABLE aheadoffice (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aheadoffice_name_id_idx ON aheadoffice (id, name);");
await ExecQueryAsync("CREATE INDEX aheadoffice_tags ON aheadoffice using GIN(tags)");
await ExecQueryAsync("ALTER TABLE acustomer add column headofficeid bigint null references aheadoffice");
//LOANUNIT
await ExecQueryAsync("CREATE TABLE aloanunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
@@ -617,6 +625,7 @@ $BODY$;
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
await ExecQueryAsync("CREATE UNIQUE INDEX aworkordertemplate_name_id_idx ON aworkordertemplate (id, name);");
await ExecQueryAsync("CREATE INDEX aworkordertemplate_tags ON aworkordertemplate using GIN(tags)");
await ExecQueryAsync("ALTER TABLE acustomer add column defaultservicetemplateid bigint null references aworkordertemplate");
//WORKORDERTEMPLATEITEM
await ExecQueryAsync("CREATE TABLE aworkordertemplateitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +