From 933e2ca846c63705190aeef99b074ad563207462 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 7 May 2020 13:53:16 +0000 Subject: [PATCH] --- .vscode/launch.json | 2 +- server/AyaNova/util/AySchema.cs | 21 ++++++++++++++++++--- server/AyaNova/util/DbUtil.cs | 2 ++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1d722811..eeacb75a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -50,7 +50,7 @@ "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_METRICS_USE_INFLUXDB": "false", - "AYANOVA_SERVER_TEST_MODE":"false", + "AYANOVA_SERVER_TEST_MODE":"true", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL":"small", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET":"-7" diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 9f05a909..1ec6a41d 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -22,8 +22,8 @@ namespace AyaNova.Util //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! private const int DESIRED_SCHEMA_LEVEL = 11; - internal const long EXPECTED_COLUMN_COUNT = 261; - internal const long EXPECTED_INDEX_COUNT = 116; + internal const long EXPECTED_COLUMN_COUNT = 277; + internal const long EXPECTED_INDEX_COUNT = 124; //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! @@ -181,7 +181,7 @@ namespace AyaNova.Util await ExecQueryAsync("CREATE TABLE auseroptions (id BIGSERIAL PRIMARY KEY, " + "userid bigint not null, translationid bigint not null REFERENCES atranslation (id), languageoverride text, timezoneoverride text, currencyname text, hour12 bool not null, emailaddress text, uicolor varchar(12) not null default '#000000')"); - + //Prime the db with the default MANAGER account await AyaNova.Biz.PrimeData.PrimeManagerAccount(ct); @@ -382,6 +382,7 @@ namespace AyaNova.Util await ExecQueryAsync("CREATE UNIQUE INDEX avendor_name_id_idx ON avendor (id, name);"); await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)"); + //---------- //WORKORDER await ExecQueryAsync("CREATE TABLE aworkorder (id BIGSERIAL PRIMARY KEY, serial bigint not null, active bool, " + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); @@ -394,6 +395,20 @@ namespace AyaNova.Util await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitem_name_id_idx ON aworkorderitem (id, name);"); await ExecQueryAsync("CREATE INDEX aworkorderitem_tags ON aworkorderitem using GIN(tags)"); + //WORKORDERITEMPART + await ExecQueryAsync("CREATE TABLE aworkorderitempart (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitempart_name_id_idx ON aworkorderitempart (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitempart_tags ON aworkorderitempart using GIN(tags)"); + + //WORKORDERITEMLABOR + await ExecQueryAsync("CREATE TABLE aworkorderitemlabor (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitemlabor_name_id_idx ON aworkorderitemlabor (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitemlabor_tags ON aworkorderitemlabor using GIN(tags)"); + //---------- + + //WORKORDERTEMPLATE await ExecQueryAsync("CREATE TABLE aworkordertemplate (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); diff --git a/server/AyaNova/util/DbUtil.cs b/server/AyaNova/util/DbUtil.cs index 8af292aa..c4061e6b 100644 --- a/server/AyaNova/util/DbUtil.cs +++ b/server/AyaNova/util/DbUtil.cs @@ -333,6 +333,8 @@ namespace AyaNova.Util await EraseTableAsync("aunit", conn); await EraseTableAsync("aunitmodel", conn); await EraseTableAsync("avendor", conn); + await EraseTableAsync("aworkorderitempart", conn); + await EraseTableAsync("aworkorderitemlabor", conn); await EraseTableAsync("aworkorderitem", conn); await EraseTableAsync("aworkorder", conn); await EraseTableAsync("aworkordertemplateitem", conn);