This commit is contained in:
@@ -675,15 +675,15 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
|
||||
//PARTSERIAL
|
||||
await ExecQueryAsync("CREATE TABLE apartserial (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial TEXT NOT NULL, " +
|
||||
"partid BIGINT NOT NULL REFERENCES apart on delete cascade, CONSTRAINT unq_partserialpart UNIQUE (partid, serial) )");//ensure not duplicate partid/serial combo
|
||||
"partid BIGINT NOT NULL REFERENCES apart ON DELETE CASCADE, CONSTRAINT unq_partserialpart UNIQUE (partid, serial) )");//ensure not duplicate partid/serial combo
|
||||
|
||||
//PARTASSEMBLY
|
||||
await ExecQueryAsync("CREATE TABLE apartassembly (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " +
|
||||
"notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY )");
|
||||
|
||||
//PARTASSEMBLYITEM
|
||||
await ExecQueryAsync("CREATE TABLE apartassemblyitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, partassemblyid BIGINT NOT NULL REFERENCES apartassembly on delete cascade, " +
|
||||
"partid BIGINT NOT NULL REFERENCES apart, quantity DECIMAL(19,4) NOT NULL default 1, " +
|
||||
await ExecQueryAsync("CREATE TABLE apartassemblyitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, partassemblyid BIGINT NOT NULL REFERENCES apartassembly 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
|
||||
")");
|
||||
// await ExecQueryAsync("CREATE INDEX idx_apartassemblyitem_partid ON apartassemblyitem(partid)");
|
||||
@@ -711,6 +711,13 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
//see what if any index tuning will help with a huge db of realistic data doing most common ops
|
||||
//await ExecQueryAsync("CREATE INDEX idx_PartInventory_SourceId_SourceType ON apartinventory (sourceid, sourcetype);");
|
||||
|
||||
//PARTSTOCKLEVEL
|
||||
await ExecQueryAsync("CREATE TABLE apartstocklevel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, partwarehouseid BIGINT NOT NULL REFERENCES apartwarehouse ON DELETE CASCADE, " +
|
||||
"partid BIGINT NOT NULL REFERENCES apart ON DELETE CASCADE, minimumquantity DECIMAL(19,4) NOT NULL default 1, " +
|
||||
"CONSTRAINT unq_partstocklevel_part_warehouse UNIQUE (partid, partwarehouseid) " +//ensure no duplicates
|
||||
")");
|
||||
|
||||
|
||||
//PROJECT
|
||||
await ExecQueryAsync("CREATE TABLE aproject (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " +
|
||||
"notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, " +
|
||||
@@ -856,7 +863,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
"deliveryaddress TEXT, linkreportid BIGINT NOT NULL, tags VARCHAR(255) ARRAY)");
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created TIMESTAMP NOT NULL, " +
|
||||
"ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, eventtype INTEGER NOT NULL, notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) on delete cascade, " +
|
||||
"ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, eventtype INTEGER NOT NULL, notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, " +
|
||||
"userid BIGINT NOT NULL REFERENCES auser (id), eventdate TIMESTAMP NOT NULL, message TEXT)");
|
||||
//these fields were in here but seem to not be required so commented out for now, see notifyevent model for deets but
|
||||
//basically remove this comment once certain don't need these fields (close to release or after)
|
||||
@@ -865,7 +872,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL REFERENCES auser (id), " +
|
||||
"created TIMESTAMP NOT NULL, ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, eventtype INTEGER NOT NULL, " +
|
||||
"notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) on delete cascade, message TEXT, fetched BOOL NOT NULL)");
|
||||
"notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, message TEXT, fetched BOOL NOT NULL)");
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed TIMESTAMP NOT NULL, " +
|
||||
"ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, eventtype INTEGER NOT NULL, notifysubscriptionid BIGINT NOT NULL, idvalue BIGINT NOT NULL, " +
|
||||
|
||||
Reference in New Issue
Block a user