From 1737488db558516cc2ad6d700e66f30abe8e8987 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 16 Feb 2021 00:37:16 +0000 Subject: [PATCH] --- server/AyaNova/util/AySchema.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 92cfbc71..e8859a87 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -654,7 +654,6 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); "webaddress TEXT, accountnumber TEXT, usesbanking BOOL, contractexpires TIMESTAMP NULL, contractid BIGINT NULL REFERENCES acontract(id), " + "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("ALTER TABLE acustomer ADD column headofficeid BIGINT NULL REFERENCES aheadoffice"); await ExecQueryAsync("ALTER TABLE auser ADD FOREIGN KEY (headofficeid) REFERENCES aheadoffice(id)"); @@ -742,10 +741,12 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //PURCHASEORDERITEM await ExecQueryAsync("CREATE TABLE apurchaseorderitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, purchaseorderid BIGINT NOT NULL REFERENCES apurchaseorder ON DELETE CASCADE, " + - "partid BIGINT NOT NULL REFERENCES apart ON DELETE CASCADE, quantity DECIMAL(19,4) NOT NULL default 1, " + - "CONSTRAINT unq_partassemblypart UNIQUE (partid, partassemblyid) " +//ensure no duplicate parts in the same assembly + "partid BIGINT NOT NULL REFERENCES apart, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse, quantityordered DECIMAL(19,4) NOT NULL default 0, " + + "quantityreceived DECIMAL(19,4) NOT NULL default 0, purchaseordercost DECIMAL(19,4) NOT NULL default 0, receivedcost DECIMAL(19,4) NOT NULL default 0, " + + "receiveddate TIMESTAMP, partrequestedbyid BIGINT REFERENCES auser, purchasetaxcodeid BIGINT REFERENCES ataxcode " + ")"); + //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, " + @@ -799,6 +800,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE aworkorderitempartrequest (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " + "notes TEXT, customfields TEXT, tags VARCHAR(255) ARRAY)"); + await ExecQueryAsync("ALTER TABLE apurchaseorderitem ADD column workorderitempartrequestid BIGINT REFERENCES aworkorderitempartrequest"); + + await ExecQueryAsync("CREATE TABLE aworkorderitemscheduleduser (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderitemid BIGINT NOT NULL REFERENCES aworkorderitem (id), " + "notes TEXT, customfields TEXT, tags VARCHAR(255) ARRAY)");