From 92056fdd78e79bfa4129ee2c757f2fb880d25295 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 20 Jan 2021 20:00:01 +0000 Subject: [PATCH] --- server/AyaNova/util/AySchema.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index d1d883d4..ae1448ff 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -689,8 +689,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); - //PART INVENTORY - + //PART INVENTORY + await ExecQueryAsync("CREATE TABLE apartinventory (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, description text null, " + "entrydate timestamp not null, lastentrydate timestamp null, partid bigint not null references apart, partwarehouseid bigint not null references apartwarehouse, " + "sourcetype integer not null, sourceid bigint not null, " + @@ -702,7 +702,10 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); "CONSTRAINT CHK_PartInventory_Valid_Dates_Sequence CHECK(lastentrydate < entrydate), " + "CONSTRAINT CHK_PartInventory_Valid_Previous_Columns CHECK((lastentrydate IS NULL AND lastbalance IS NULL) OR (lastentrydate IS NOT NULL AND lastbalance IS NOT NULL)) " + " )"); - await ExecQueryAsync("CREATE INDEX idx_aservicebank_objectid_objecttype ON aservicebank (objectid, objecttype );"); + //MIGRATE_OUTSTANDING: index(s) to support inventory ops + //recheck this again once have full inventory in place and run some manual queries taken from inventory methods and issued by ef core + //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);");