Real world workorder fields!!!! It's happening finally!

This commit is contained in:
2021-03-25 18:50:23 +00:00
parent 53c3aa192d
commit dec705a957

View File

@@ -834,11 +834,15 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//WORKORDER
await ExecQueryAsync("CREATE TABLE aworkorder (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 )");
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, customerid BIGINT NOT NULL REFERENCES acustomer (id), "
+ "projectid BIGINT NOT NULL REFERENCES aproject (id), internalreferencenumber text, customerreferencenumber text, customercontactname text, "
+ "servicedate TIMESTAMP, completebydate TIMESTAMP, invoicenumber TEXT, customersignature TEXT, customersignaturename TEXT, customersignaturecaptured TIMESTAMP, "
+ "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) "
+ ")");
await ExecQueryAsync("CREATE TABLE aworkorderstate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderid BIGINT NOT NULL REFERENCES aworkorder (id), "
+ "workorderstatusid BIGINT NOT NULL REFERENCES aworkorderstatus (id), created TIMESTAMP NOT NULL, userid BIGINT NOT NULL REFERENCES auser (id)"
+")");
+ "workorderstatusid BIGINT NOT NULL REFERENCES aworkorderstatus (id), created TIMESTAMP NOT NULL, userid BIGINT NOT NULL REFERENCES auser (id)"
+ ")");
await ExecQueryAsync("CREATE TABLE aworkorderitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderid BIGINT NOT NULL REFERENCES aworkorder (id), "
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY )");
@@ -959,6 +963,12 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
+ "requestedbyuserid BIGINT NOT NULL REFERENCES auser(id), customerreferencenumber TEXT, status INTEGER NOT NULL, priority INTEGER NOT NULL "
+ ")");
//WORKORDER "FROM" LINKS
await ExecQueryAsync("ALTER TABLE aworkorder ADD column fromquoteid BIGINT REFERENCES aquote (id), ADD column frompmid BIGINT REFERENCES apm (id), ADD column fromcsrid BIGINT REFERENCES acustomerservicerequest (id)");
await SetSchemaLevelAsync(++currentSchema);
}