This commit is contained in:
2020-12-31 17:41:09 +00:00
parent 652c482cba
commit 09090d0752
4 changed files with 119 additions and 24 deletions

View File

@@ -352,15 +352,15 @@ BEGIN
when 23 then aytable = 'apmtemplate';
when 24 then aytable = 'apmtemplateitem';
when 25 then aytable = 'aproject';
when 26 then aytable = 'apurchaseorder'; aynamecolumn ='serial';
when 27 then aytable = 'aquote'; aynamecolumn ='serial';
when 26 then aytable = 'apurchaseorder'; aynamecolumn = 'serial';
when 27 then aytable = 'aquote'; aynamecolumn = 'serial';
when 28 then aytable = 'aquoteitem';
when 29 then aytable = 'aquotetemplate';
when 30 then aytable = 'aquotetemplateitem';
when 31 then aytable = 'aunit';
when 31 then aytable = 'aunit'; aynamecolumn = 'serial';
when 32 then aytable = 'aunitmodel'; aynamecolumn = 'number';
when 33 then aytable = 'avendor';
when 34 then aytable = 'aworkorder'; aynamecolumn ='serial';
when 34 then aytable = 'aworkorder'; aynamecolumn = 'serial';
when 35 then return 'LT:WorkOrderItem';
when 36 then return 'LT:WorkOrderItemExpense';
when 37 then return 'LT:WorkOrderItemLabor';
@@ -715,11 +715,20 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (vendorid) REFERENCES avendor(id)");
//UNIT
await ExecQueryAsync("CREATE TABLE aunit (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 aunit_name_id_idx ON aunit (id, name);");
await ExecQueryAsync("CREATE TABLE aunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
"serial text not null, customerid bigint not null references acustomer(id), parentunitid bigint null references aunit(id), " +
"unitmodelid bigint null references aunitmodel(id), unithasownaddress bool, boughthere bool, purchasedfromvendorid bigint null references avendor(id), " +
"receipt text null, purchaseddate timestamp null, description text null, replacedbyunitid bigint null references aunit(id), " +
"overridemodelwarranty bool, warrantylength integer null, warrantyterms text null, usesbanking bool, metered bool, lifetimewarranty bool, " +
"text1 text null, text2 text null, text3 text null, text4 text null " +
" )");
// await ExecQueryAsync("CREATE UNIQUE INDEX aunit_name_id_idx ON aunit (id, name);");
await ExecQueryAsync("CREATE INDEX aunit_tags ON aunit using GIN(tags)");
//UNITMODEL
await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text null, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +