This commit is contained in:
@@ -1000,13 +1000,101 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//PM
|
||||
await ExecQueryAsync("CREATE TABLE apm (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, active BOOL NOT NULL, "
|
||||
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY )");
|
||||
//----------
|
||||
|
||||
|
||||
|
||||
/*
|
||||
██████╗ ███╗ ███╗
|
||||
██╔══██╗████╗ ████║
|
||||
██████╔╝██╔████╔██║
|
||||
██╔═══╝ ██║╚██╔╝██║
|
||||
██║ ██║ ╚═╝ ██║
|
||||
╚═╝ ╚═╝ ╚═╝
|
||||
*/
|
||||
|
||||
|
||||
//PM
|
||||
await ExecQueryAsync("CREATE TABLE apm (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, "
|
||||
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, customerid BIGINT NOT NULL REFERENCES acustomer (id), "
|
||||
+ "projectid BIGINT REFERENCES aproject, laststatusid BIGINT REFERENCES apmstatus(id), contractid BIGINT NULL, internalreferencenumber text, "
|
||||
+ "customerreferencenumber text, customercontactname text, createddate TIMESTAMP NOT NULL, "
|
||||
+ "preparedbyid BIGINT REFERENCES auser(id), introduction TEXT, requested TIMESTAMP, validuntil TIMESTAMP, submitted TIMESTAMP, approved TIMESTAMP, onsite BOOL NOT NULL, "
|
||||
+ "postaddress TEXT, postcity TEXT, postregion TEXT, postcountry TEXT, postcode TEXT, address TEXT, city TEXT, region TEXT, country TEXT, latitude DECIMAL(9,6), longitude DECIMAL(9,6) "
|
||||
+ ")");
|
||||
|
||||
|
||||
//PMITEM
|
||||
await ExecQueryAsync("CREATE TABLE apmitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmid BIGINT NOT NULL REFERENCES apm (id), "
|
||||
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, technotes TEXT, workorderitemstatusid BIGINT REFERENCES aworkorderitemstatus (id), "
|
||||
+ " workorderitempriorityid BIGINT REFERENCES aworkorderitempriority (id), requestdate TIMESTAMP, warrantyservice BOOL NOT NULL, sequence INTEGER"
|
||||
+ ")");
|
||||
|
||||
//PMITEM EXPENSE
|
||||
await ExecQueryAsync("CREATE TABLE apmitemexpense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "description TEXT, name TEXT, totalcost DECIMAL(38,18) NOT NULL default 0, chargeamount DECIMAL(38,18) NOT NULL default 0, taxpaid DECIMAL(38,18) NOT NULL default 0, "
|
||||
+ "chargetaxcodeid BIGINT REFERENCES ataxcode, reimburseuser BOOL NOT NULL, userid BIGINT REFERENCES auser, chargetocustomer BOOL NOT NULL "
|
||||
+ ")");
|
||||
|
||||
//PMITEM LABOR
|
||||
await ExecQueryAsync("CREATE TABLE apmitemlabor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "userid BIGINT REFERENCES auser, servicestartdate TIMESTAMP, servicestopdate TIMESTAMP, servicerateid BIGINT REFERENCES aservicerate, servicedetails text, "
|
||||
+ "serviceratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, "
|
||||
+ "taxcodesaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(38,18) "
|
||||
+ ")");
|
||||
|
||||
//PMITEM LOAN
|
||||
await ExecQueryAsync("CREATE TABLE apmitemloan (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "notes TEXT, outdate TIMESTAMP, duedate TIMESTAMP, returndate TIMESTAMP,cost DECIMAL(38,18) NOT NULL default 0, listprice DECIMAL(38,18) NOT NULL default 0, priceoverride DECIMAL(38,18), "
|
||||
+ "taxcodeid BIGINT REFERENCES ataxcode, loanunitid BIGINT NOT NULL REFERENCES aloanunit, quantity DECIMAL(19,5) NOT NULL default 0, rate INTEGER NOT NULL"
|
||||
+ ")");
|
||||
|
||||
//PMITEM PART
|
||||
await ExecQueryAsync("CREATE TABLE apmitempart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "description TEXT, serials TEXT, partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, quantity DECIMAL(19,5) NOT NULL default 0, "
|
||||
+ "cost DECIMAL(38,18) NOT NULL default 0, listprice DECIMAL(38,18) NOT NULL default 0, taxpartsaleid BIGINT REFERENCES ataxcode, priceoverride DECIMAL(38,18) "
|
||||
+ ")");
|
||||
|
||||
//PMITEM SCHEDULED USER
|
||||
await ExecQueryAsync("CREATE TABLE apmitemscheduleduser (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "userid BIGINT REFERENCES auser, startdate TIMESTAMP, stopdate TIMESTAMP, servicerateid BIGINT REFERENCES aservicerate, "
|
||||
+ "estimatedquantity DECIMAL(19,5) NOT NULL default 0"
|
||||
+ ")");
|
||||
|
||||
//PMITEM TASK
|
||||
await ExecQueryAsync("CREATE TABLE apmitemtask (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "sequence INTEGER NOT NULL DEFAULT 0, task text NOT NULL, status INTEGER NOT NULL DEFAULT 1, completedbyuserid BIGINT REFERENCES auser, completeddate TIMESTAMP"
|
||||
+ ")");
|
||||
|
||||
//PMITEM TRAVEL
|
||||
await ExecQueryAsync("CREATE TABLE apmitemtravel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "userid BIGINT REFERENCES auser, travelstartdate TIMESTAMP, travelstopdate TIMESTAMP, travelrateid BIGINT REFERENCES atravelrate, traveldetails text, "
|
||||
+ "travelratequantity DECIMAL(19,5) NOT NULL default 0, nochargequantity DECIMAL(19,5) NOT NULL default 0, "
|
||||
+ "taxcodesaleid BIGINT REFERENCES ataxcode, distance DECIMAL(19,5) NOT NULL default 0, priceoverride DECIMAL(38,18) "
|
||||
+ ")");
|
||||
|
||||
//PMITEM UNIT
|
||||
await ExecQueryAsync("CREATE TABLE apmitemunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, unitid BIGINT NOT NULL REFERENCES aunit"
|
||||
+ ")");
|
||||
|
||||
//PMITEM OUTSIDE SERVICE
|
||||
await ExecQueryAsync("CREATE TABLE apmitemoutsideservice (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmitemid BIGINT NOT NULL REFERENCES apmitem (id), "
|
||||
+ "notes TEXT, unitid BIGINT NOT NULL REFERENCES aunit, vendorsenttoid BIGINT REFERENCES avendor, vendorsentviaid BIGINT REFERENCES avendor, rmanumber text, trackingnumber text, "
|
||||
+ "taxcodeid BIGINT REFERENCES ataxcode, repaircost DECIMAL(38,18) NOT NULL default 0, repairprice DECIMAL(38,18) NOT NULL default 0, shippingcost DECIMAL(38,18) NOT NULL default 0, shippingprice DECIMAL(38,18) NOT NULL default 0, "
|
||||
+ "SentDate TIMESTAMP, etadate TIMESTAMP, returndate TIMESTAMP"
|
||||
+ ")");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//PMITEM
|
||||
await ExecQueryAsync("CREATE TABLE apmitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, pmid BIGINT NOT NULL REFERENCES apm (id), name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, "
|
||||
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY )");
|
||||
|
||||
//CUSTOMERSERVICEREQUEST
|
||||
await ExecQueryAsync("CREATE TABLE acustomerservicerequest (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, "
|
||||
|
||||
Reference in New Issue
Block a user