From cb9a69ec887f15feabe134d57239a6131dcf8980 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 11 May 2020 15:35:20 +0000 Subject: [PATCH] --- server/AyaNova/util/AySchema.cs | 58 +++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 87207abf..8abaa274 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -389,23 +389,67 @@ namespace AyaNova.Util await ExecQueryAsync("CREATE INDEX aworkorder_serial_id_idx ON aworkorder (id, serial);");//is this necessary or fruitful? await ExecQueryAsync("CREATE INDEX aworkorder_tags ON aworkorder using GIN(tags)"); - //WORKORDERITEM + await ExecQueryAsync("CREATE TABLE aworkorderitem (id BIGSERIAL PRIMARY KEY, workorderid bigint not null REFERENCES aworkorder (id), " + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); - // await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitem_name_id_idx ON aworkorderitem (id, name);"); + // 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 aworkorderitemexpense (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + + "notes text NULL, customfields text NULL, tags varchar(255) ARRAY NULL)"); + // await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitemexpense_name_id_idx ON aworkorderitemexpense (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitemexpense_tags ON aworkorderitemexpense using GIN(tags)"); + + + await ExecQueryAsync("CREATE TABLE aworkorderitemlabor (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + + "notes 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)"); + + + await ExecQueryAsync("CREATE TABLE aworkorderitemloan (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + + "notes text NULL, customfields text NULL, tags varchar(255) ARRAY NULL)"); + // await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitemloan_name_id_idx ON aworkorderitemloan (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitemloan_tags ON aworkorderitemloan using GIN(tags)"); + + await ExecQueryAsync("CREATE TABLE aworkorderitempart (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + "notes 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), " + + + await ExecQueryAsync("CREATE TABLE aworkorderitempartrequest (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + "notes 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)"); + // await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitempartrequest_name_id_idx ON aworkorderitempartrequest (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitempartrequest_tags ON aworkorderitempartrequest using GIN(tags)"); + + + await ExecQueryAsync("CREATE TABLE aworkorderitemscheduleduser (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + + "notes text NULL, customfields text NULL, tags varchar(255) ARRAY NULL)"); + // await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitemscheduleduser_name_id_idx ON aworkorderitemscheduleduser (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitemscheduleduser_tags ON aworkorderitemscheduleduser using GIN(tags)"); + + + await ExecQueryAsync("CREATE TABLE aworkorderitemtask (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + + "notes text NULL, customfields text NULL, tags varchar(255) ARRAY NULL)"); + // await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitemtask_name_id_idx ON aworkorderitemtask (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitemtask_tags ON aworkorderitemtask using GIN(tags)"); + + + await ExecQueryAsync("CREATE TABLE aworkorderitemtravel (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + + "notes text NULL, customfields text NULL, tags varchar(255) ARRAY NULL)"); + // await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitemtravel_name_id_idx ON aworkorderitemtravel (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitemtravel_tags ON aworkorderitemtravel using GIN(tags)"); + + + await ExecQueryAsync("CREATE TABLE aworkorderitemunit (id BIGSERIAL PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " + + "notes text NULL, customfields text NULL, tags varchar(255) ARRAY NULL)"); + // await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitemunit_name_id_idx ON aworkorderitemunit (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitemunit_tags ON aworkorderitemunit using GIN(tags)"); + + //----------