This commit is contained in:
2021-01-14 15:37:08 +00:00
parent 178047e006
commit 0636316651
2 changed files with 36 additions and 4 deletions

View File

@@ -60,6 +60,36 @@ namespace AyaNova.Biz
}
}
/*
static void Main(string[] args)
{
using (var dbContext = new DbParentChild())
{
var parent = new Parent
{
FirstName = "Joe",
LastName = "Smith"
};
parent.Children.Add(
new Child
{
FirstName = "LittleJoe",
LastName = "Smith"
});
parent.Children.Add(
new Child
{
FirstName = "Anne",
LastName = "Smith"
});
dbContext.Add(parent);
dbContext.SaveChanges();
}
}
*/
////////////////////////////////////////////////////////////////////////////////////////////////
//DUPLICATE
//

View File

@@ -23,7 +23,7 @@ namespace AyaNova.Util
private const int DESIRED_SCHEMA_LEVEL = 15;
internal const long EXPECTED_COLUMN_COUNT = 667;
internal const long EXPECTED_INDEX_COUNT = 185;
internal const long EXPECTED_INDEX_COUNT = 186;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -679,7 +679,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("ALTER TABLE acustomer add column headofficeid bigint null references aheadoffice");
await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (headofficeid) REFERENCES aheadoffice(id)");
//VENDOR
await ExecQueryAsync("CREATE TABLE avendor (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, webaddress text, popupnotes text, accountnumber text, " +
@@ -693,7 +693,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//PART
await ExecQueryAsync("CREATE TABLE apart (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text, active bool not null, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, " +
"partnumber text not null unique, popupnotes text, manufacturerid bigint REFERENCES avendor, manufacturernumber text, "+
"partnumber text not null unique, popupnotes text, manufacturerid bigint REFERENCES avendor, manufacturernumber text, " +
"wholesalerid bigint REFERENCES avendor, wholesalernumber text, alternativewholesalerid bigint REFERENCES avendor, alternativewholesalernumber text, " +
"cost decimal(19,4) not null, retail decimal(19,4) not null, unitofmeasure text, upc text, trackserialnumber bool not null " +
" )");
@@ -708,7 +708,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//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)");
"partid bigint not null REFERENCES apart, " +
"CONSTRAINT UNQ_PartAssemblyPart UNIQUE (partid, partassemblyid) " +//ensure no duplicate parts in the same assembly
")");
await ExecQueryAsync("CREATE INDEX idx_apartassemblyitem_part ON apartassemblyitem(partid)");
await ExecQueryAsync("CREATE INDEX idx_apartassemblyitem_partassembly ON apartassemblyitem(partassemblyid)");