This commit is contained in:
@@ -49,7 +49,8 @@ namespace AyaNova.Util
|
||||
***************************** WARNING: Be careful here, if a standard field is hideable and also it's DB SCHEMA is set to NON NULLABLE then the CLIENT end needs to set a default
|
||||
***************************** Otherwise the hidden field can't be set and the object can't be saved EVER
|
||||
|
||||
|
||||
Official guidance on index analysis
|
||||
https://www.postgresql.org/docs/13/monitoring-stats.html
|
||||
|
||||
*/
|
||||
#region unused index query
|
||||
@@ -677,18 +678,6 @@ $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)");
|
||||
|
||||
|
||||
//LOANUNIT
|
||||
await ExecQueryAsync("CREATE TABLE aloanunit (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 " +
|
||||
"serial text, workorderitemloanid null references aworkorderitemloan(id), unitid null references aunit(id), defaultrate integer not null, " +
|
||||
"ratehour decimal(19,4) not null, ratehalfday decimal(19,4) not null, rateday decimal(19,4) not null, rateweek decimal(19,4) not null, ratemonth decimal(19,4) not null, rateyear decimal(19,4) not null " +
|
||||
")");
|
||||
await ExecQueryAsync("CREATE UNIQUE INDEX aloanunit_name_id_idx ON aloanunit (id, name);");
|
||||
await ExecQueryAsync("CREATE INDEX aloanunit_tags ON aloanunit using GIN(tags)");
|
||||
|
||||
|
||||
|
||||
//PART
|
||||
await ExecQueryAsync("CREATE TABLE apart (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 )");
|
||||
@@ -743,6 +732,16 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
await ExecQueryAsync("CREATE UNIQUE INDEX aunit_serial_id_idx ON aunit (id, serial);");
|
||||
await ExecQueryAsync("CREATE INDEX aunit_tags ON aunit using GIN(tags)");
|
||||
|
||||
//LOANUNIT
|
||||
await ExecQueryAsync("CREATE TABLE aloanunit (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 " +
|
||||
"serial text, unitid bigint null references aunit(id), defaultrate integer not null, " +
|
||||
"ratehour decimal(19,4) not null, ratehalfday decimal(19,4) not null, rateday decimal(19,4) not null, rateweek decimal(19,4) not null, ratemonth decimal(19,4) not null, rateyear decimal(19,4) not null " +
|
||||
")");
|
||||
await ExecQueryAsync("CREATE UNIQUE INDEX aloanunit_name_id_idx ON aloanunit (id, name);");
|
||||
await ExecQueryAsync("CREATE INDEX aloanunit_tags ON aloanunit using GIN(tags)");
|
||||
|
||||
|
||||
|
||||
//----------
|
||||
//WORKORDER
|
||||
@@ -775,6 +774,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
// 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("ALTER TABLE aloanunit add column workorderitemloanid bigint null references aworkorderitemloan");
|
||||
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE aworkorderitempart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid bigint not null REFERENCES aworkorderitem (id), " +
|
||||
"notes text, customfields text, tags varchar(255) ARRAY)");
|
||||
|
||||
Reference in New Issue
Block a user