From 75be65c8716d1994bd51684250a3d6e7906dd63a Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 10 Nov 2020 20:29:14 +0000 Subject: [PATCH] --- server/AyaNova/util/AySchema.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index cfb5a097..3d4e6bc6 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -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, " +