This commit is contained in:
2020-04-15 22:59:49 +00:00
parent 464cab837e
commit a6737df4f0
9 changed files with 68 additions and 48 deletions

View File

@@ -20,10 +20,10 @@ namespace AyaNova.Util
/////////// CHANGE THIS ON NEW SCHEMA UPDATE ////////////////////
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 11;
private const int DESIRED_SCHEMA_LEVEL = 10;
internal const long EXPECTED_COLUMN_COUNT = 105;
internal const long EXPECTED_INDEX_COUNT = 33;
internal const long EXPECTED_COLUMN_COUNT = 103;
internal const long EXPECTED_INDEX_COUNT = 31;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -172,7 +172,7 @@ namespace AyaNova.Util
await ExecQueryAsync("CREATE TABLE auser (id BIGSERIAL PRIMARY KEY, active bool not null, name varchar(255) not null unique, " +
"login text not null, password text not null, salt text not null, roles integer not null, " +
"dlkey text, dlkeyexpire timestamp, usertype integer not null, employeenumber varchar(255), notes text, customerid bigint, " +
"headofficeid bigint, subvendorid bigint, customfields text, tags varchar(255) ARRAY)");
"headofficeid bigint, subvendorid bigint, wikicontent text null, customfields text, tags varchar(255) ARRAY)");
//Index for name fetching
await ExecQueryAsync("CREATE UNIQUE INDEX auser_name_id_idx ON auser (id, name);");
@@ -212,7 +212,7 @@ namespace AyaNova.Util
//id, text, longtext, boolean, currency,
await ExecQueryAsync("CREATE TABLE awidget (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, serial bigint not null," +
"startdate timestamp, enddate timestamp, dollaramount decimal(19,5), active bool, usertype int4, count integer," +
"notes text, userid bigint null, customfields text, tags varchar(255) ARRAY)");
"notes text, userid bigint null, wikicontent text null, customfields text, tags varchar(255) ARRAY)");
//TEST TEST TEST ONLY FOR DEVELOPMENT TESTING TO ENSURE UNIQUENESS
//exec("CREATE UNIQUE INDEX awidget_serial_idx ON awidget (serial);");
@@ -315,22 +315,22 @@ namespace AyaNova.Util
}
//////////////////////////////////////////////////
// WikiPage table
if (currentSchema < 11)
{
LogUpdateMessage(log);
// //////////////////////////////////////////////////
// // WikiPage table
// if (currentSchema < 11)
// {
// LogUpdateMessage(log);
await ExecQueryAsync("CREATE TABLE awikipage (id BIGSERIAL PRIMARY KEY, " +
"objectid bigint not null, objecttype integer not null, " +
"content text)");
// await ExecQueryAsync("CREATE TABLE awikipage (id BIGSERIAL PRIMARY KEY, " +
// "objectid bigint not null, objecttype integer not null, " +
// "content text)");
//INDEX: Most selective first as there is more unique ID's than unique types
//to take advantage of this always query with where objectid=xx and objecttype=yy order
await ExecQueryAsync("CREATE INDEX awikipage_typeid_idx ON awikipage (objectid, objecttype );");
// //INDEX: Most selective first as there is more unique ID's than unique types
// //to take advantage of this always query with where objectid=xx and objecttype=yy order
// await ExecQueryAsync("CREATE INDEX awikipage_typeid_idx ON awikipage (objectid, objecttype );");
await SetSchemaLevelAsync(++currentSchema);
}
// await SetSchemaLevelAsync(++currentSchema);
// }