From e67bd0f70869934f1829697d8b1eac6e8dcd9ca6 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 13 Jan 2021 15:39:29 +0000 Subject: [PATCH] --- .vscode/launch.json | 2 +- server/AyaNova/util/AySchema.cs | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e2049e9..8fd97968 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -53,7 +53,7 @@ "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", - "AYANOVA_SERVER_TEST_MODE": "false", + "AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 04a9d301..1d7f46b4 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -679,6 +679,17 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("ALTER TABLE acustomer add column headofficeid bigint null references aheadoffice"); await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (headofficeid) REFERENCES aheadoffice(id)"); + + //VENDOR + await ExecQueryAsync("CREATE TABLE avendor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool not null, " + + "notes text, wiki text, customfields text, tags varchar(255) ARRAY, webaddress text, popupnotes text, accountnumber text, " + + "contact text, contactnotes text, phone1 text, phone2 text, phone3 text, phone4 text, phone5 text, emailaddress text, " + + "postaddress text, postcity text, postregion text, postcountry text, postcode text, address text, city text, region text, country text, latitude decimal(8,6), longitude decimal(9,6))"); + await ExecQueryAsync("CREATE UNIQUE INDEX avendor_name_id_idx ON avendor (id, name);"); + await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)"); + await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (vendorid) REFERENCES avendor(id)"); + + //PART await ExecQueryAsync("CREATE TABLE apart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text, active bool not null, " + "notes text, wiki text, customfields text, tags varchar(255) ARRAY, " + @@ -692,8 +703,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //PARTASSEMBLY await ExecQueryAsync("CREATE TABLE apartassembly (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool not null, " + "notes text, wiki text, customfields text, tags varchar(255) ARRAY )"); - await ExecQueryAsync("CREATE UNIQUE INDEX apart_name_id_idx ON apartassembly (id, name);"); - await ExecQueryAsync("CREATE INDEX apart_tags ON apartassembly using GIN(tags)"); + await ExecQueryAsync("CREATE UNIQUE INDEX apartassembly_name_id_idx ON apartassembly (id, name);"); + await ExecQueryAsync("CREATE INDEX apartassembly_tags ON apartassembly using GIN(tags)"); //PARTASSEMBLYITEM await ExecQueryAsync("CREATE TABLE apartassemblyitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, partassemblyid bigint not null REFERENCES apartassembly, " + @@ -714,15 +725,6 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE UNIQUE INDEX apurchaseorder_serial_id_idx ON apurchaseorder (id, serial);"); await ExecQueryAsync("CREATE INDEX apurchaseorder_tags ON apurchaseorder using GIN(tags)"); - //VENDOR - await ExecQueryAsync("CREATE TABLE avendor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool not null, " + - "notes text, wiki text, customfields text, tags varchar(255) ARRAY, webaddress text, popupnotes text, accountnumber text, " + - "contact text, contactnotes text, phone1 text, phone2 text, phone3 text, phone4 text, phone5 text, emailaddress text, " + - "postaddress text, postcity text, postregion text, postcountry text, postcode text, address text, city text, region text, country text, latitude decimal(8,6), longitude decimal(9,6))"); - await ExecQueryAsync("CREATE UNIQUE INDEX avendor_name_id_idx ON avendor (id, name);"); - await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)"); - await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (vendorid) REFERENCES avendor(id)"); - //UNITMODEL await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text null, active bool not null, " + "notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +