Merge pull request #109 from Basimodo:FinalizeDbStructureForMileStoneMVP

Finalize db structure for mile stone mvp
pull/1/head
Sascha 2021-06-28 13:48:30 +07:00 committed by GitHub
commit 8ee1c2ca0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 668 additions and 894 deletions

@ -79,8 +79,6 @@ namespace Gremlin.GremlinData.DBClasses
/// Initialzes the Db with enum data: product lines, account types, submarkets /// Initialzes the Db with enum data: product lines, account types, submarkets
{ {
DateTime now = DateTime.Now;
//PRODUCT LINES //PRODUCT LINES
string[] ProductLineAbbrviations = { "XF", "LM", "XA", "RB", "GE", string[] ProductLineAbbrviations = { "XF", "LM", "XA", "RB", "GE",
"9Z", "9P", "9M", "9K", "9H", "9Z", "9P", "9M", "9K", "9H",
@ -1051,6 +1049,8 @@ namespace Gremlin.GremlinData.DBClasses
{ {
// Read current line fields, pointer moves to the next line. // Read current line fields, pointer moves to the next line.
string[] fields = csvParser.ReadFields(); string[] fields = csvParser.ReadFields();
//string productNumber = fields[0];
//string? optionNumber = fields[1] == "" ? null : fields[1];
CustomDescription ImportedCD = new() CustomDescription ImportedCD = new()
{ {
ProductNumber = fields[0], ProductNumber = fields[0],
@ -1060,7 +1060,7 @@ namespace Gremlin.GremlinData.DBClasses
CoverletterText = fields[5], CoverletterText = fields[5],
Notes = fields[6], Notes = fields[6],
}; };
ImportedCD.Product = new(); ImportedCD.Products = new List<Product>();
ImportedCD.Supplier = new(); ImportedCD.Supplier = new();
ImportedCD.Supplier.AccountName = fields[2] is "" or "RB" ? "Agilent Technologies" : fields[2]; ImportedCD.Supplier.AccountName = fields[2] is "" or "RB" ? "Agilent Technologies" : fields[2];
MetaDataSetter.ForImport(ImportedCD, "Importer", "Initial Importer by CD-ImporterFomCsv"); MetaDataSetter.ForImport(ImportedCD, "Importer", "Initial Importer by CD-ImporterFomCsv");
@ -1117,12 +1117,12 @@ namespace Gremlin.GremlinData.DBClasses
foreach (CustomDescription CD in CDsReadFromFile) foreach (CustomDescription CD in CDsReadFromFile)
{ {
//Skip Desciptions, if it has been already imported above (as part from 3PP) //Skip Desciptions, if it has been already imported above (as part from 3PP)
if (thirdPartyProductsFromImportedCDs.Contains(CD.Product)) continue; if (thirdPartyProductsFromImportedCDs.Intersect(CD.Products).Any()) continue;
//Establish EF Reference. If no PN/Opt found, then skip this custom description. //Establish EF Reference. If no PN/Opt found, then skip this custom description.
//CD.Product = GetProduct(db, CD.ProductNumber, CD.OptionNumber); //ResolveXY-functions return null, if no match is found in db. //CD.Product = GetProduct(db, CD.ProductNumber, CD.OptionNumber); //ResolveXY-functions return null, if no match is found in db.
CD.Product = productsInDb.Find(p => p.ProductNumber == CD.ProductNumber && p.OptionNumber == CD.OptionNumber); CD.Products = productsInDb.Where(product => product.ProductNumber == CD.ProductNumber && product.OptionNumber == CD.OptionNumber).ToList();
if (CD.Product == null) if (CD.Products == null)
{ {
CDsWithoutEFReferences.Add(CD); CDsWithoutEFReferences.Add(CD);
continue; continue;
@ -1206,7 +1206,7 @@ namespace Gremlin.GremlinData.DBClasses
importedCD.CoverletterText = stringsRead.ElementAt(5); importedCD.CoverletterText = stringsRead.ElementAt(5);
importedCDs.Add(importedCD); importedCDs.Add(importedCD);
if (importedCDs.Count >= 1200 && importedCDs.Count % 100 == 0) MessageBox.Show(importedCDs.Count.ToString()); //DEBUGGING //if (importedCDs.Count >= 1200 && importedCDs.Count % 100 == 0) MessageBox.Show(importedCDs.Count.ToString()); //DEBUGGING
} }
} }
@ -1260,11 +1260,12 @@ namespace Gremlin.GremlinData.DBClasses
foreach (CustomDescription CD in importedCDs) foreach (CustomDescription CD in importedCDs)
{ {
//Skip Desciptions, if it has been already imported above (as part from 3PP) //Skip Desciptions, if it has been already imported above (as part from 3PP)
if (thirdPartyProductsFromImportedCDs.Contains(CD.Product)) continue; if (thirdPartyProductsFromImportedCDs.Intersect(CD.Products).Any()) continue;
//Establish EF Reference. If no PN/Opt found, then skip this custom description. //Establish EF Reference. If no PN/Opt found, then skip this custom description.
CD.Product = ResolveProduct(db, CD.ProductNumber, CD.OptionNumber); //ResolveXY-functions return null, if no match is found in db. CD.Products.Add(ResolveProduct(db, CD.ProductNumber, CD.OptionNumber)); //ResolveXY-functions return null, if no match is found in db.
if (CD.Product == null)
if (CD.Products == null)
{ {
CDsWithoutEFReferences.Add(CD); CDsWithoutEFReferences.Add(CD);
continue; continue;

@ -11,119 +11,38 @@ namespace Gremlin.GremlinData.DBClasses
{ {
entity.HasKey(e => e.AccountId); entity.HasKey(e => e.AccountId);
entity.HasMany(d => d.Contacts).WithOne(p => p.Account).IsRequired(true); entity.HasMany(d => d.Contacts).WithOne(p => p.Account).IsRequired(true);
entity.HasOne(d => d.AccountType).WithMany(p => p.Accounts).IsRequired(true); entity.HasOne(d => d.AccountType).WithMany(p => p.Accounts).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
entity.HasOne(d => d.SubMarket).WithMany(p => p.Accounts).IsRequired(true); entity.HasOne(d => d.SubMarket).WithMany(p => p.Accounts).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
entity.HasAlternateKey(e => e.SAPAccountNumber); // =Unique entity.HasAlternateKey(e => e.SAPAccountNumber); // =Unique
entity.Property(e => e.AccountId)
.ValueGeneratedOnAdd() entity.Property(e => e.AccountId).ValueGeneratedOnAdd();
;
entity.Property(e => e.ParentAccountId); entity.Property(e => e.ParentAccountId);
entity.Property(e => e.DataCreationDate) entity.Property(e => e.AccountName).IsRequired(true).HasMaxLength(250);
.HasColumnType("TIMESTAMP") //.HasColumnType("VARCHAR(250)") ist überflüssig, da .HasMaxLength(250) VARCHAR(250) impliziert.
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataValidFrom)
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataValidUntil)
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataVersionNumber)
.HasDefaultValue(1)
.IsRequired(true)
;
entity.Property(e => e.DataVersionComment)
.HasDefaultValue("")
;
entity.Property(e => e.DataStatus)
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
.IsRequired(true)
;
entity.Property(e => e.DataModificationDate)
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
.IsConcurrencyToken(true)
;
entity.Property(e => e.DataModificationByUser)
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
;
entity.Property(e => e.AccountName)
.IsRequired(true)
//.HasColumnType("VARCHAR(250)")
.HasMaxLength(250) //impliziert (mit diesem Wert?) VARCHAR
;
entity.Property(e => e.Notes); entity.Property(e => e.Notes);
entity.Property(e => e.Street) entity.Property(e => e.Street).IsRequired(true).HasMaxLength(100);
.IsRequired(true) entity.Property(e => e.ZIP).IsRequired(true).HasColumnType("Char(5)");
.HasMaxLength(100) //impliziert (mit diesem Wert?) VARCHAR entity.Property(e => e.City).IsRequired(true).HasMaxLength(50);
; entity.Property(e => e.FloorOrBuilding).HasMaxLength(50);
//entity.Property(e => e.Streetnumber) entity.Property(e => e.Longitude);
// .IsRequired(true) entity.Property(e => e.Latitude);
// .HasMaxLength(20) entity.Property(e => e.PhoneNumber).IsRequired(true).HasMaxLength(30);
// ; entity.Property(e => e.FaxNumber).HasMaxLength(30);
entity.Property(e => e.ZIP) entity.Property(e => e.Webpage).HasMaxLength(250);
.IsRequired(true) entity.Property(e => e.EMail).HasMaxLength(150);
.HasColumnType("Char(5)") entity.Property(e => e.SAPAccountNumber).IsRequired(true);
//.HasMaxLength(5) //impliziert (mit diesem Wert?) VARCHAR entity.Property(e => e.AccountCreatedInSAPOn).IsRequired(true);
;
entity.Property(e => e.City) entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
.IsRequired(true) entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
.HasMaxLength(50) entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
; entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
entity.Property(e => e.FloorOrBuilding) entity.Property(e => e.DataVersionComment).HasDefaultValue("");
//.HasColumnType("VARCHAR(50)") entity.Property(e => e.DataStatus).IsRequired(true);
.HasMaxLength(50) //impliziert (mit diesem Wert?) VARCHAR //.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
; entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
entity.Property(e => e.Longitude) //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
// .HasDefaultValue(null) entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
;
entity.Property(e => e.Latitude)
// .HasDefaultValue(null)
;
entity.Property(e => e.PhoneNumber)
.IsRequired(true)
.HasMaxLength(30)
;
entity.Property(e => e.FaxNumber)
.HasMaxLength(30)
;
entity.Property(e => e.Webpage)
//.HasColumnType("VARCHAR(250)")
.HasMaxLength(250) //impliziert (mit diesem Wert?) VARCHAR
;
entity.Property(e => e.EMail)
//.IsRequired(true)
.HasMaxLength(150) //impliziert (mit diesem Wert?) VARCHAR
;
//entity.Property(e => e.DateOfCreationInSAP);
//entity.Property(e => e.SubMarketCode);
//entity.Property(e => e.SubMarket);
//entity.Property(e => e.AccountType)
// .IsRequired(true)
// .HasColumnType("Char(3)")
// ;
//entity.Property(e => e.SubMarket)
// .IsRequired(true)
// .HasColumnType("Char(3)")
// ;
//entity.Property(e => e.LinkToSAP)
// .HasColumnType("Text");
// --> in DbHelper mit eigener Funktion aus den SAP-Ids konstruieren.
entity.Property(e => e.SAPAccountNumber)
.IsRequired(true)
;
entity.Property(e => e.AccountCreatedInSAPOn)
.IsRequired(true)
;
} }
} }
@ -132,176 +51,68 @@ namespace Gremlin.GremlinData.DBClasses
public void Configure(EntityTypeBuilder<Contact> entity) public void Configure(EntityTypeBuilder<Contact> entity)
{ {
entity.HasKey(e => e.ContactId); entity.HasKey(e => e.ContactId);
//entity.HasMany(d => d.CommunicationChannels).WithOne(p => p.Contact).IsRequired(true);
entity.HasOne(p => p.Account).WithMany(d => d.Contacts).IsRequired(true); entity.HasOne(p => p.Account).WithMany(d => d.Contacts).IsRequired(true);
//entity.HasAlternateKey(e => e.SAPContactNumber); //entity.HasAlternateKey(e => e.SAPContactNumber);
entity.Property(e => e.ContactId); entity.Property(e => e.ContactId);
entity.Property(e => e.DataCreationDate) entity.Property(e => e.SAPContactNumber).IsRequired(true);
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationDate)
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
.IsConcurrencyToken(true)
;
entity.Property(e => e.DataValidFrom)
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationByUser)
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
;
entity.Property(e => e.DataValidUntil)
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataVersionNumber)
.HasDefaultValue(1)
.IsRequired(true)
;
entity.Property(e => e.DataVersionComment)
.HasDefaultValue("")
;
entity.Property(e => e.DataStatus)
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
.IsRequired(true)
;
entity.Property(e => e.SAPContactNumber)
.IsRequired(true)
;
entity.Property(e => e.AcademicTitle); entity.Property(e => e.AcademicTitle);
entity.Property(e => e.FirstName); entity.Property(e => e.FirstName);
entity.Property(e => e.LastName) entity.Property(e => e.LastName).IsRequired(true);
.IsRequired(true) entity.Property(e => e.Gender);
; //.IsRequired(true) darf nicht gesetzt werden, da sonst vom DB-Engine NULL nicht erlaubt wird (trotz Definition als Bool? im Code. MySQL kennt kein Bool, sondern wandelt das intern in Tinyint um).
entity.Property(e => e.Gender) entity.Property(e => e.OptInStatus).HasDefaultValue(null);
//.IsRequired(true) //darf nicht gesetzt werden, da sonst vom DB-Engine NULL nicht erlaubt wird (trotz Definition als Bool? im Code. MySQL kennt kein Bool, sondern wandelt das intern in Tinyint um). entity.Property(e => e.IsReference).HasDefaultValue(false);
;
entity.Property(e => e.OptInStatus)
.HasDefaultValue(null)
;
entity.Property(e => e.IsReference)
.HasDefaultValue(false)
;
entity.Property(e => e.Notes); entity.Property(e => e.Notes);
entity.Property(e => e.LinkToSAP); entity.Property(e => e.ValidatedContact).HasDefaultValue(false);
entity.Property(e => e.ValidatedContact)
.HasDefaultValue(false) entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
; entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
entity.Property(e => e.DataVersionComment).HasDefaultValue("");
entity.Property(e => e.DataStatus).IsRequired(true);
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
//.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
} }
} }
//public class CommunicationChannelConfiguration : IEntityTypeConfiguration<CommunicationChannel>
//{
// public void Configure(EntityTypeBuilder<CommunicationChannel> entity)
// {
// entity.HasKey("CommunicationChannelId");
// entity.HasOne(p => p.Contact).WithMany(e => e.CommunicationChannels).HasForeignKey("ContactId").IsRequired(true);
// entity.Property(e => e.DataCreationDate)
// .HasColumnType("TIMESTAMP")
// .HasDefaultValueSql("CURRENT_TIMESTAMP")
// .ValueGeneratedOnAdd()
// ;
// entity.Property(e => e.DataModificationDate)
// .HasColumnType("TIMESTAMP")
// .HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
// .ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
// .IsConcurrencyToken(true)
// ;
// entity.Property(e => e.DataValidFrom)
// .HasColumnType("DATETIME")
// .HasDefaultValueSql("CURRENT_TIMESTAMP")
// .ValueGeneratedOnAdd()
// ;
// entity.Property(e => e.DataModificationByUser)
// .HasColumnType("TINYTEXT")
// .HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
// ;
// entity.Property(e => e.DataValidUntil)
// .HasColumnType("DATETIME")
// .HasDefaultValueSql("'9999-12-31 23:59:59.000000'")
// .ValueGeneratedOnAdd()
// ;
// entity.Property(e => e.DataVersionNumber)
// .HasDefaultValue(1)
// .IsRequired(true)
// ;
// entity.Property(e => e.DataVersionComment)
// .HasDefaultValue("")
// ;
// entity.Property(e => e.DataStatus)
// //.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
// .IsRequired(true)
// ;
// entity.Property(e => e.Typ)
// .IsRequired()
// .HasMaxLength(50)
// ;
// entity.Property(e => e.Number)
// .IsRequired()
// .HasMaxLength(250)
// ;
// entity.Property(e => e.IsPreferred)
// .HasDefaultValue(false)
// ;
// }
//}
public class QuoteConfiguration : IEntityTypeConfiguration<Quote> public class QuoteConfiguration : IEntityTypeConfiguration<Quote>
{ {
public void Configure(EntityTypeBuilder<Quote> entity) public void Configure(EntityTypeBuilder<Quote> entity)
{ {
entity.HasKey(e => e.QuoteId); entity.HasKey(e => e.QuoteId);
entity.HasMany(d => d.LineItems).WithOne(p => p.Quote); entity.HasMany(d => d.LineItems).WithOne(p => p.Quote).IsRequired(false).OnDelete(DeleteBehavior.Cascade);
//entity.HasOne(p => p.Recipient).WithMany(e => e.Quotes);
entity.Property(e => e.DataCreated) entity.Property(e => e.QuotationNumber).HasColumnType("VARCHAR(255)").IsRequired(true).ValueGeneratedOnAdd();
.HasColumnType("TIMESTAMP") entity.Property(e => e.QuotationDate).IsRequired(true).ValueGeneratedOnAdd();
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModified)
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
.IsConcurrencyToken(true)
;
entity.Property(e => e.QuotationNumber)
.HasColumnType("VARCHAR(255)")
.IsRequired(true)
.ValueGeneratedOnAdd()
;
entity.Property(e => e.QuotationDate)
.IsRequired(true)
.ValueGeneratedOnAdd()
;
entity.Property(e => e.ValidUntil); entity.Property(e => e.ValidUntil);
entity.Property(e => e.ValidFor) entity.Property(e => e.ValidFor).IsRequired(true);
//.HasColumnType("TINYINT")
.IsRequired(true)
;
//entity.Property(e => e.SalesRep);
entity.Ignore("SalesRep"); entity.Ignore("SalesRep");
entity.Property(e => e.TotalListprice); entity.Property(e => e.TotalListprice);
entity.Property(e => e.TotalDiscount); entity.Property(e => e.TotalDiscount);
entity.Property(e => e.TotalNet); entity.Property(e => e.TotalNet);
entity.Property(e => e.VAT) entity.Property(e => e.VAT);
//.HasDefaultValue("19")
;
entity.Property(e => e.TotalGross); entity.Property(e => e.TotalGross);
entity.Property(e => e.QuoteContains3PP) entity.Property(e => e.QuoteContains3PP).HasDefaultValue(false);
.HasDefaultValue(false); entity.Property(e => e.QuoteContainsRB).HasDefaultValue(false);
entity.Property(e => e.QuoteContainsRB)
.HasDefaultValue(false);
entity.Property(e => e.QuoteTemplate); entity.Property(e => e.QuoteTemplate);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
entity.Property(e => e.DataVersionComment).HasDefaultValue("");
entity.Property(e => e.DataStatus).IsRequired(true);
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
//.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
} }
} }
@ -309,55 +120,36 @@ namespace Gremlin.GremlinData.DBClasses
{ {
public void Configure(EntityTypeBuilder<LineItem> entity) public void Configure(EntityTypeBuilder<LineItem> entity)
{ {
entity.HasKey(e => e.QuoteId); entity.HasKey(e => e.LineItemId);
entity.HasOne(p => p.Quote).WithMany(d => d.LineItems).HasForeignKey(fk => fk.QuoteId); entity.HasOne(p => p.Quote).WithMany(d => d.LineItems).HasForeignKey(fk => fk.QuoteId).IsRequired(true).OnDelete(DeleteBehavior.Cascade);
entity.Property(e => e.DataCreated)
.HasColumnType("TIMESTAMP") entity.Property(e => e.Position).IsRequired(true);
.HasDefaultValueSql("CURRENT_TIMESTAMP") entity.Property(e => e.Amount).IsRequired(true);
.ValueGeneratedOnAdd() entity.Property(e => e.ProductNumber).IsRequired(true);
;
entity.Property(e => e.DataModified)
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
.IsConcurrencyToken(true)
;
entity.Property(e => e.Position)
.IsRequired(true)
;
entity.Property(e => e.Amount)
.IsRequired(true)
;
entity.Property(e => e.ProductNumber)
.IsRequired(true)
;
entity.Property(e => e.OptionNumber); entity.Property(e => e.OptionNumber);
entity.Property(e => e.SapShortDescription); entity.Property(e => e.SapShortDescription);
entity.Property(e => e.SapLongDescription); entity.Property(e => e.SapLongDescription);
entity.Property(e => e.ProductLine); entity.Property(e => e.ProductLine);
entity.Property(e => e.TotalDiscount) entity.Property(e => e.TotalDiscount).IsRequired(true).HasDefaultValue(0);
.IsRequired(true) entity.Property(e => e.SalesDiscount).IsRequired(true).HasDefaultValue(0);
.HasDefaultValue(0); entity.Property(e => e.PromotionalDiscount).IsRequired(true).HasDefaultValue(0);
entity.Property(e => e.SalesDiscount) entity.Property(e => e.ContractualDiscount).IsRequired(true).HasDefaultValue(0);
.IsRequired(true) entity.Property(e => e.DemoDiscount).IsRequired(true).HasDefaultValue(0);
.HasDefaultValue(0); entity.Property(e => e.ListPrice).IsRequired(true);
entity.Property(e => e.PromotionalDiscount) entity.Property(e => e.ExtendedListPrice).IsRequired(true);
.IsRequired(true) entity.Property(e => e.NetPrice).IsRequired(true);
.HasDefaultValue(0); entity.Property(e => e.Total).IsRequired(true);
entity.Property(e => e.ContractualDiscount)
.IsRequired(true) entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
.HasDefaultValue(0); entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DemoDiscount) entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
.IsRequired(true) entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
.HasDefaultValue(0); entity.Property(e => e.DataVersionComment).HasDefaultValue("");
entity.Property(e => e.ListPrice) entity.Property(e => e.DataStatus).IsRequired(true);
.IsRequired(true); //.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
entity.Property(e => e.ExtendedListPrice) entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
.IsRequired(true); //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
entity.Property(e => e.NetPrice) entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
.IsRequired(true);
entity.Property(e => e.Total)
.IsRequired(true);
} }
} }
@ -366,56 +158,28 @@ namespace Gremlin.GremlinData.DBClasses
public void Configure(EntityTypeBuilder<Product> entity) public void Configure(EntityTypeBuilder<Product> entity)
{ {
entity.HasKey(e => e.ProductId); entity.HasKey(e => e.ProductId);
entity.HasOne(d => d.CustomDescription).WithOne(p => p.Product); entity.HasOne(d => d.CustomDescription).WithMany(p => p.Products).HasForeignKey("CustomDescriptionId").IsRequired(false).OnDelete(DeleteBehavior.Restrict);
//entity.HasOne(p => p.ProductLine).WithMany(d => d.Products); entity.HasOne(p => p.ProductLine).WithMany(d => d.Products).HasForeignKey("ProductLineCode").IsRequired(true).OnDelete(DeleteBehavior.Restrict);
entity.Property(e => e.DataCreationDate)
.HasColumnType("TIMESTAMP") entity.Property(e => e.ProductNumber).IsRequired(true);
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationDate)
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
.IsConcurrencyToken(true)
;
entity.Property(e => e.DataValidFrom)
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationByUser)
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.ValueGeneratedOnAddOrUpdate()
;
entity.Property(e => e.DataValidUntil)
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataVersionNumber)
.HasDefaultValue(1)
.IsRequired(true)
;
entity.Property(e => e.DataVersionComment)
.HasDefaultValue("")
;
entity.Property(e => e.DataStatus)
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
.IsRequired(true)
;
entity.Property(e => e.ProductNumber)
.IsRequired(true)
;
entity.Property(e => e.OptionNumber); entity.Property(e => e.OptionNumber);
entity.Property(e => e.SapShortDescription); entity.Property(e => e.SapShortDescription);
entity.Property(e => e.SapLongDescription); entity.Property(e => e.SapLongDescription);
entity.Property(e => e.Weight); entity.Property(e => e.Weight);
entity.Property(e => e.ProductStatus); entity.Property(e => e.ProductStatus);
entity.Property(e => e.IntroductionDate); entity.Property(e => e.IntroductionDate);
entity.Property(e => e.ListPrice) entity.Property(e => e.ListPrice).IsRequired(true);
.IsRequired(true);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
entity.Property(e => e.DataVersionComment).HasDefaultValue("");
entity.Property(e => e.DataStatus).IsRequired(true);
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
//.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
} }
} }
@ -424,53 +188,26 @@ namespace Gremlin.GremlinData.DBClasses
public void Configure(EntityTypeBuilder<CustomDescription> entity) public void Configure(EntityTypeBuilder<CustomDescription> entity)
{ {
entity.HasKey(e => e.CustomDescriptionId); entity.HasKey(e => e.CustomDescriptionId);
entity.HasOne(p => p.Product).WithOne(d => d.CustomDescription) entity.HasMany(p => p.Products).WithOne(d => d.CustomDescription).IsRequired(false);
//.HasForeignKey("ProductId") entity.HasOne(p => p.Supplier).WithMany(d => d.CustomDescriptions).IsRequired(true);
;
entity.Property(e => e.DataCreationDate) entity.Property(e => e.ProductNumber).IsRequired(true);
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationDate)
.HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
.IsConcurrencyToken(true)
;
entity.Property(e => e.DataValidFrom)
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationByUser)
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
;
entity.Property(e => e.DataValidUntil)
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataVersionNumber)
.HasDefaultValue(1)
.IsRequired(true)
;
entity.Property(e => e.DataVersionComment)
.HasDefaultValue("")
;
entity.Property(e => e.DataStatus)
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
.IsRequired(true)
;
entity.Property(e => e.ProductNumber)
.IsRequired(true);
entity.Property(e => e.OptionNumber); entity.Property(e => e.OptionNumber);
entity.Property(e => e.Heading) entity.Property(e => e.Heading).IsRequired(true);
.IsRequired(true);
entity.Property(e => e.DescriptionText); entity.Property(e => e.DescriptionText);
entity.Property(e => e.CoverletterText); entity.Property(e => e.CoverletterText);
entity.Property(e => e.Notes); entity.Property(e => e.Notes);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
entity.Property(e => e.DataVersionComment).HasDefaultValue("");
entity.Property(e => e.DataStatus).IsRequired(true);
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
//.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
} }
} }
@ -479,43 +216,18 @@ namespace Gremlin.GremlinData.DBClasses
public void Configure(EntityTypeBuilder<ProductLine> entity) public void Configure(EntityTypeBuilder<ProductLine> entity)
{ {
//entity.HasKey(e => e.ProductLineId); //Property removed. PK is AccountTypeCode (defined via data annotation in class). //entity.HasKey(e => e.ProductLineId); //Property removed. PK is AccountTypeCode (defined via data annotation in class).
entity.HasMany(p => p.Products).WithOne(d => d.ProductLine); entity.HasMany(p => p.Products).WithOne(d => d.ProductLine).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
entity.Property(e => e.DataCreationDate)
.HasColumnType("TIMESTAMP") entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
.HasDefaultValueSql("CURRENT_TIMESTAMP") entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
.ValueGeneratedOnAdd() entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
; entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
entity.Property(e => e.DataModificationDate) entity.Property(e => e.DataVersionComment).HasDefaultValue("");
.HasColumnType("TIMESTAMP") entity.Property(e => e.DataStatus).IsRequired(true);
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") //.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true) entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
.IsConcurrencyToken(true) //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
; entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
entity.Property(e => e.DataValidFrom)
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationByUser)
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
;
entity.Property(e => e.DataValidUntil)
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataVersionNumber)
.HasDefaultValue(1)
.IsRequired(true)
;
entity.Property(e => e.DataVersionComment)
.HasDefaultValue("")
;
entity.Property(e => e.DataStatus)
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
.IsRequired(true)
;
} }
} }
@ -525,50 +237,19 @@ namespace Gremlin.GremlinData.DBClasses
{ {
//entity.HasKey(e => e.AccountTypeCode); //entity.HasKey(e => e.AccountTypeCode);
//entity.HasMany(p => p.Accounts).WithOne(d => d.AccountType); //already defined in class Account //entity.HasMany(p => p.Accounts).WithOne(d => d.AccountType); //already defined in class Account
entity.Property(e => e.DataCreationDate) entity.Property(e => e.AccountTypeCode).IsRequired(true).HasColumnType("Char(3)");
.HasColumnType("TIMESTAMP") entity.Property(e => e.AccountTypeDescription).HasColumnType("Varchar(1000)");
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd() entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
; entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataModificationDate) entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
.HasColumnType("TIMESTAMP") entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") entity.Property(e => e.DataVersionComment).HasDefaultValue("");
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true) entity.Property(e => e.DataStatus).IsRequired(true);
.IsConcurrencyToken(true) //.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
; entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
entity.Property(e => e.DataValidFrom) //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
.HasColumnType("DATETIME") entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationByUser)
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
;
entity.Property(e => e.DataValidUntil)
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataVersionNumber)
.HasDefaultValue(1)
.IsRequired(true)
;
entity.Property(e => e.DataVersionComment)
.HasDefaultValue("")
;
entity.Property(e => e.DataStatus)
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
.IsRequired(true)
;
entity.Property(e => e.AccountTypeCode)
.IsRequired(true)
.HasColumnType("Char(3)")
;
entity.Property(e => e.AccountTypeDescription)
.HasColumnType("Varchar(1000)")
//.IsRequired(true)
;
} }
} }
@ -578,50 +259,19 @@ namespace Gremlin.GremlinData.DBClasses
{ {
//entity.HasKey(e => e.SubMarketCode); //entity.HasKey(e => e.SubMarketCode);
//entity.HasMany(p => p.Accounts).WithOne(d => d.SubMarket); //already defined in class Account //entity.HasMany(p => p.Accounts).WithOne(d => d.SubMarket); //already defined in class Account
entity.Property(e => e.DataCreationDate) entity.Property(e => e.SubMarketCode).HasColumnType("Char(3)");
.HasColumnType("TIMESTAMP") entity.Property(e => e.SubMarketDescription).HasColumnType("Varchar(1000)");
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd() entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
; entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataModificationDate) entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
.HasColumnType("TIMESTAMP") entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") entity.Property(e => e.DataVersionComment).HasDefaultValue("");
.ValueGeneratedOnAddOrUpdate() //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true) entity.Property(e => e.DataStatus).IsRequired(true);
.IsConcurrencyToken(true) //.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
; entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
entity.Property(e => e.DataValidFrom) //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
.HasColumnType("DATETIME") entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataModificationByUser)
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
;
entity.Property(e => e.DataValidUntil)
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'")
.ValueGeneratedOnAdd()
;
entity.Property(e => e.DataVersionNumber)
.HasDefaultValue(1)
.IsRequired(true)
;
entity.Property(e => e.DataVersionComment)
.HasDefaultValue("")
;
entity.Property(e => e.DataStatus)
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
.IsRequired(true)
;
entity.Property(e => e.SubMarketCode)
//.IsRequired(true) //implizit gesetzt durch PK.
.HasColumnType("Char(3)")
;
entity.Property(e => e.SubMarketDescription)
.HasColumnType("Varchar(1000)")
//.IsRequired(true)
;
} }
} }
@ -631,13 +281,13 @@ namespace Gremlin.GremlinData.DBClasses
{ {
builder.HasKey(e => e.RegisteredUserID); builder.HasKey(e => e.RegisteredUserID);
builder.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
builder.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
builder.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
builder.HasMany(d => d.RUSettings).WithOne(p => p.RegisteredUser).IsRequired(true); builder.HasMany(d => d.RUSettings).WithOne(p => p.RegisteredUser).IsRequired(true);
builder.Property(e => e.UserName).IsRequired(true); builder.Property(e => e.UserName).IsRequired(true);
builder.Property(e => e.PasswordHash).IsRequired(true); builder.Property(e => e.PasswordHash).IsRequired(true);
builder.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
builder.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
builder.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
} }
} }
@ -647,13 +297,13 @@ namespace Gremlin.GremlinData.DBClasses
{ {
builder.HasKey(e => e.RUSettingsID); builder.HasKey(e => e.RUSettingsID);
builder.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
builder.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
builder.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
builder.HasOne(d => d.RegisteredUser).WithMany(p => p.RUSettings).IsRequired(true); builder.HasOne(d => d.RegisteredUser).WithMany(p => p.RUSettings).IsRequired(true);
builder.Property(e => e.SettingKey).IsRequired(true); builder.Property(e => e.SettingKey).IsRequired(true);
builder.Property(e => e.SettingValue).IsRequired(true); builder.Property(e => e.SettingValue).IsRequired(true);
builder.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
builder.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
builder.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
} }
} }
} }

@ -321,7 +321,7 @@ namespace Gremlin.GremlinData.DBClasses
DataValidUntil = FarInTheFuture, DataValidUntil = FarInTheFuture,
DataVersionComment = "Initial Importer by CD-ImporterFomCsv", DataVersionComment = "Initial Importer by CD-ImporterFomCsv",
}; };
ImportedCD.Product = new(); ImportedCD.Products = new List<Product>();
ImportedCD.Supplier = new(); ImportedCD.Supplier = new();
ImportedCD.Supplier.AccountName = fields[2] is "" or "RB" ? "Agilent Technologies" : fields[2]; ImportedCD.Supplier.AccountName = fields[2] is "" or "RB" ? "Agilent Technologies" : fields[2];
ImportedCD.DataCreationDate = ImportedCD.DataValidFrom = ImportedCD.DataModificationDate = DateTime.Now; ImportedCD.DataCreationDate = ImportedCD.DataValidFrom = ImportedCD.DataModificationDate = DateTime.Now;
@ -378,12 +378,12 @@ namespace Gremlin.GremlinData.DBClasses
foreach (CustomDescription CD in CDsReadFromFile) foreach (CustomDescription CD in CDsReadFromFile)
{ {
//Skip Desciptions, if it has been already imported above (as part from 3PP) //Skip Desciptions, if it has been already imported above (as part from 3PP)
if (thirdPartyProductsFromImportedCDs.Contains(CD.Product)) continue; if (thirdPartyProductsFromImportedCDs.Intersect(CD.Products).Any()) continue;
//Establish EF Reference. If no PN/Opt found, then skip this custom description. //Establish EF Reference. If no PN/Opt found, then skip this custom description.
//CD.Product = GetProduct(db, CD.ProductNumber, CD.OptionNumber); //ResolveXY-functions return null, if no match is found in db. //CD.Product = GetProduct(db, CD.ProductNumber, CD.OptionNumber); //ResolveXY-functions return null, if no match is found in db.
CD.Product = productsInDb.Find(p => p.ProductNumber == CD.ProductNumber && p.OptionNumber == CD.OptionNumber); CD.Products = productsInDb.Where(product => product.ProductNumber == CD.ProductNumber && product.OptionNumber == CD.OptionNumber).ToList();
if (CD.Product == null) if (CD.Products == null)
{ {
CDsWithoutEFReferences.Add(CD); CDsWithoutEFReferences.Add(CD);
continue; continue;

@ -10,24 +10,12 @@ namespace Gremlin.GremlinData.EntityClasses
public uint AccountId { get; set; } public uint AccountId { get; set; }
//foreign keys: //foreign keys:
public ICollection<Contact> Contacts { get; set; } public IList<Contact> Contacts { get; set; }
public int? ParentAccountId { get; set; } public uint? ParentAccountId { get; set; }
public AccountType AccountType { get; set; } public AccountType AccountType { get; set; }
public SubMarket SubMarket { get; set; } public SubMarket SubMarket { get; set; }
//public int AddressId { get; set; } public IList<CustomDescription> CustomDescriptions { get; set; }
//public ICollection<string> MarketsServed { get; set; }
//public ICollection<CommunicationChannel> CommunicationChannels { get; set; }
//standard properties:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataModificationByUser { get; set; }
public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; }
public string DataStatus { get; set; }
//class properties: //class properties:
public string AccountName { get; set; } public string AccountName { get; set; }
public string Notes { get; set; } public string Notes { get; set; }
@ -43,20 +31,24 @@ namespace Gremlin.GremlinData.EntityClasses
public string EMail { get; set; } public string EMail { get; set; }
//Agilent-specific Properties: //Agilent-specific Properties:
//public string AccountTypeCode { get; set; } //enum
//public string AccountSubMarketCode { get; set; } //enum
public uint SAPAccountNumber { get; set; } public uint SAPAccountNumber { get; set; }
public DateTime AccountCreatedInSAPOn { get; set; } public DateTime AccountCreatedInSAPOn { get; set; }
//metadata:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataModificationByUser { get; set; }
public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; }
public string DataStatus { get; set; }
//IBase //IBase
//tbd //tbd
public Account() public Account()
{ {
//AccountType = new AccountType();
//SubMarket = new SubMarket();
//Contacts = new List<Contact>();
} }
//public bool Equals(Account other) //public bool Equals(Account other)

@ -14,8 +14,10 @@ namespace Gremlin.GremlinData.EntityClasses
//navigation properties: //navigation properties:
public IList<Account> Accounts { get; set; } public IList<Account> Accounts { get; set; }
//standard properties: //class properties:
//Ist das hier bei einer de-facto-Enumeration wirklich nötig? public string AccountTypeDescription { get; set; }
//metadata:
public DateTime DataCreationDate { get; set; } public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; } public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; } public DateTime DataValidFrom { get; set; }
@ -24,8 +26,5 @@ namespace Gremlin.GremlinData.EntityClasses
public uint DataVersionNumber { get; set; } public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; } public string DataVersionComment { get; set; }
public string DataStatus { get; set; } public string DataStatus { get; set; }
//class properties:
public string AccountTypeDescription { get; set; }
} }
} }

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
namespace Gremlin.GremlinData.EntityClasses namespace Gremlin.GremlinData.EntityClasses
{ {
@ -9,31 +10,15 @@ namespace Gremlin.GremlinData.EntityClasses
//foreign keys: //foreign keys:
public uint AccountId { get; set; } public uint AccountId { get; set; }
//public uint QuoteId { get; set; }
//navigation properties: //navigation properties:
public Account Account { get; set; } public Account Account { get; set; }
//public IList<Quote> Quotes { get; set; } public IList<Quote> Quotes { get; set; }
//standard properties:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataModificationByUser { get; set; }
public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; }
public string DataStatus { get; set; }
//class properties: //class properties:
public string AcademicTitle { get; set; } public string AcademicTitle { get; set; }
public string FirstName { get; set; } public string FirstName { get; set; }
public string LastName { get; set; } public string LastName { get; set; }
/// <summary>
/// enum Gender
///
/// 0 = unknown, 1 = male, 2 = female, 3 = divers
/// </summary>
public byte Gender { get; set; } public byte Gender { get; set; }
public bool? OptInStatus { get; set; } public bool? OptInStatus { get; set; }
public string Department { get; set; } public string Department { get; set; }
@ -49,8 +34,7 @@ namespace Gremlin.GremlinData.EntityClasses
public bool EmailBounced { get; set; } public bool EmailBounced { get; set; }
public bool NoHardcopyMailing { get; set; } public bool NoHardcopyMailing { get; set; }
public bool ValidatedContact { get; set; } public bool ValidatedContact { get; set; }
//public ICollection<CommunicationChannel> CommunicationChannels { get; set; }
//Agilent-specific Properties: //Agilent-specific Properties:
public int SAPContactNumber { get; set; } public int SAPContactNumber { get; set; }
public DateTime SAPContactCreationDate { get; set; } public DateTime SAPContactCreationDate { get; set; }
@ -60,11 +44,19 @@ namespace Gremlin.GremlinData.EntityClasses
public string SAPApplicationInterest { get; set; } public string SAPApplicationInterest { get; set; }
public string SAPJobLevel { get; set; } public string SAPJobLevel { get; set; }
public string SAPCompetitiveIBase { get; set; } public string SAPCompetitiveIBase { get; set; }
public string LinkToSAP { get; set; }
//metadata:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataModificationByUser { get; set; }
public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; }
public string DataStatus { get; set; }
public Contact() public Contact()
{ {
//Account = DbHelper.ResolveAccountById(new GremlinContext(), AccountId);
} }
} }
} }

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
namespace Gremlin.GremlinData.EntityClasses namespace Gremlin.GremlinData.EntityClasses
{ {
@ -6,26 +7,15 @@ namespace Gremlin.GremlinData.EntityClasses
{ {
//primary key: //primary key:
public uint CustomDescriptionId { get; set; } public uint CustomDescriptionId { get; set; }
//use composite key PN + Opt instead?
//foreign keys: //foreign keys:
public uint ProductId { get; set; } //public uint ProductId { get; set; }
public uint AccountId { get; set; } public uint AccountId { get; set; }
//navigation properties: //navigation properties:
public Product Product { get; set; } public IList<Product> Products { get; set; }
public Account Supplier { get; set; } public Account Supplier { get; set; }
//standard properties:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataModificationByUser { get; set; }
public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; }
public string DataStatus { get; set; }
//class properties: //class properties:
public string ProductNumber { get; set; } public string ProductNumber { get; set; }
public string OptionNumber { get; set; } public string OptionNumber { get; set; }
@ -37,12 +27,19 @@ namespace Gremlin.GremlinData.EntityClasses
//Agilent-Specific properties: //Agilent-Specific properties:
//NONE //NONE
//metadata:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataModificationByUser { get; set; }
public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; }
public string DataStatus { get; set; }
//Constructors //Constructors
public CustomDescription() public CustomDescription()
{ {
//Product = new Product();
//Supplier = new Account();
} }
} }
} }

@ -2,7 +2,7 @@
namespace Gremlin.GremlinData.EntityClasses namespace Gremlin.GremlinData.EntityClasses
{ {
public class LineItem public class LineItem : IMetadata
{ {
//primary key: //primary key:
public uint LineItemId { get; set; } public uint LineItemId { get; set; }
@ -13,10 +13,6 @@ namespace Gremlin.GremlinData.EntityClasses
//navigation properties: //navigation properties:
public Quote Quote { get; set; } public Quote Quote { get; set; }
//standard properties:
public DateTime DataCreated { get; set; }
public DateTime DataModified { get; set; }
//class properties: //class properties:
public ushort Position { get; set; } public ushort Position { get; set; }
public ushort Amount { get; set; } public ushort Amount { get; set; }
@ -34,5 +30,15 @@ namespace Gremlin.GremlinData.EntityClasses
public decimal ExtendedListPrice { get; set; } public decimal ExtendedListPrice { get; set; }
public decimal NetPrice { get; set; } public decimal NetPrice { get; set; }
public decimal Total { get; set; } public decimal Total { get; set; }
//metadata:
public DateTime DataCreationDate { get; set; }
public string DataModificationByUser { get; set; }
public DateTime DataModificationDate { get; set; }
public string DataStatus { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataVersionComment { get; set; }
public uint DataVersionNumber { get; set; }
} }
} }

@ -9,7 +9,7 @@ namespace Gremlin.GremlinData.EntityClasses
public uint LoggedInUserID { get; set; } public uint LoggedInUserID { get; set; }
//navigation properties //navigation properties
public ICollection<LoggedInUserSettings> LoggedInUserSettings { get; set; } public IList<LoggedInUserSettings> LoggedInUserSettings { get; set; }
//standard properties //standard properties
public DateTime DataCreationDate { get; set; } public DateTime DataCreationDate { get; set; }

@ -7,21 +7,15 @@ namespace Gremlin.GremlinData.EntityClasses
//primary key: //primary key:
public uint ProductId { get; set; } public uint ProductId { get; set; }
//standard properties:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataModificationByUser { get; set; }
public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; }
public string DataStatus { get; set; }
//navigation properties: //navigation properties:
public CustomDescription CustomDescription { get; set; } public CustomDescription CustomDescription { get; set; }
public ProductLine ProductLine { get; set; } public ProductLine ProductLine { get; set; }
//class properties = Agilent-specific properties: //foreign keys
public uint CustomDescriptionId { get; set; }
public string ProductLineCode { get; set; }
//Agilent-specific properties:
public string ProductNumber { get; set; } public string ProductNumber { get; set; }
public string OptionNumber { get; set; } public string OptionNumber { get; set; }
public string SapShortDescription { get; set; } public string SapShortDescription { get; set; }
@ -34,11 +28,20 @@ namespace Gremlin.GremlinData.EntityClasses
public int BreakRangeFrom { get; set; } public int BreakRangeFrom { get; set; }
public int BreakRangeTo { get; set; } public int BreakRangeTo { get; set; }
//metadata:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataModificationByUser { get; set; }
public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; }
public string DataStatus { get; set; }
//Constructors //Constructors
public Product() public Product()
{ {
//ProductLine = new ProductLine();
} }
} }

@ -14,8 +14,10 @@ namespace Gremlin.GremlinData.EntityClasses
//navigation properties: //navigation properties:
public List<Product> Products { get; set; } public List<Product> Products { get; set; }
//standard properties: //class properties:
//Ist das hier bei einer de-facto-Enumeration wirklich nötig? public string ProductLineDescription { get; set; }
//metadata:
public DateTime DataCreationDate { get; set; } public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; } public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; } public DateTime DataValidFrom { get; set; }
@ -24,8 +26,5 @@ namespace Gremlin.GremlinData.EntityClasses
public uint DataVersionNumber { get; set; } public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; } public string DataVersionComment { get; set; }
public string DataStatus { get; set; } public string DataStatus { get; set; }
//class properties:
public string ProductLineDescription { get; set; }
} }
} }

@ -3,28 +3,24 @@ using System.Collections.Generic;
namespace Gremlin.GremlinData.EntityClasses namespace Gremlin.GremlinData.EntityClasses
{ {
public class Quote public class Quote : IMetadata
{ {
//primary key: //primary key:
public uint QuoteId { get; set; } public uint QuoteId { get; set; }
//foreign keys: //foreign keys:
public ICollection<LineItem> LineItems { get; set; } public Contact Recipient { get; set; }
public IList<LineItem> LineItems { get; set; }
//navigation properties: //navigation properties:
//NONE //NONE
//standard properties:
public DateTime DataCreated { get; set; }
public DateTime DataModified { get; set; }
//class properties: //class properties:
public Contact SalesRep { get; set; }
public string QuotationNumber { get; set; } public string QuotationNumber { get; set; }
public DateTime QuotationDate { get; set; } public DateTime QuotationDate { get; set; }
public DateTime ValidUntil { get; set; } public DateTime ValidUntil { get; set; }
public byte ValidFor { get; set; } public byte ValidFor { get; set; }
public Contact Recipient { get; set; }
public Contact SalesRep { get; set; }
public decimal TotalListprice { get; set; } public decimal TotalListprice { get; set; }
public decimal TotalDiscount { get; set; } public decimal TotalDiscount { get; set; }
public decimal TotalNet { get; set; } public decimal TotalNet { get; set; }
@ -34,22 +30,18 @@ namespace Gremlin.GremlinData.EntityClasses
public bool QuoteContainsRB { get; set; } public bool QuoteContainsRB { get; set; }
public string QuoteTemplate { get; set; } public string QuoteTemplate { get; set; }
//metadata:
public DateTime DataCreationDate { get; set; }
public string DataModificationByUser { get; set; }
public DateTime DataModificationDate { get; set; }
public string DataStatus { get; set; }
public DateTime DataValidFrom { get; set; }
public DateTime DataValidUntil { get; set; }
public string DataVersionComment { get; set; }
public uint DataVersionNumber { get; set; }
internal Quote() internal Quote()
{ {
////Initialize
//QuotationDate = DateTime.Now;
////LineItems = new List<LineItem>();
//TotalGross = 0;
//TotalListprice = 0;
//TotalDiscount = 0;
//TotalNet = 0;
//QuoteContains3PP = false;
//QuoteContainsRB = false;
// set quote number
// set validity depending on account classification
// populate SalesRep data (CurrentUser)
// populate Addressee data
} }
} }
} }

@ -13,15 +13,15 @@ namespace Gremlin.GremlinData.EntityClasses
//navigation properties //navigation properties
public RegisteredUser RegisteredUser { get; set; } public RegisteredUser RegisteredUser { get; set; }
//standard properties:
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public string DataModificationByUser { get; set; }
//class properties //class properties
public string SettingKey { get; set; } public string SettingKey { get; set; }
public string SettingValue { get; set; } public string SettingValue { get; set; }
//metadata (subset of IMetadata)
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public string DataModificationByUser { get; set; }
//Constructur //Constructur
public RUSetting() public RUSetting()
{ {

@ -9,16 +9,16 @@ namespace Gremlin.GremlinData.EntityClasses
public uint RegisteredUserID { get; set; } public uint RegisteredUserID { get; set; }
//navigation properties //navigation properties
public ICollection<RUSetting> RUSettings { get; set; } public IList<RUSetting> RUSettings { get; set; }
//standard properties
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public string DataModificationByUser { get; set; }
//class properties //class properties
public string UserName { get; set; } public string UserName { get; set; }
public string PasswordHash { get; set; } public string PasswordHash { get; set; }
//metadata (subset of IMetadata)
public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; }
public string DataModificationByUser { get; set; }
//Constructur //Constructur
public RegisteredUser() public RegisteredUser()

@ -14,8 +14,10 @@ namespace Gremlin.GremlinData.EntityClasses
//navigation properties: //navigation properties:
public IList<Account> Accounts { get; set; } public IList<Account> Accounts { get; set; }
//standard properties: //class properties:
//Ist das hier bei einer de-facto-Enumeration wirklich nötig? public string SubMarketDescription { get; set; }
//metadata
public DateTime DataCreationDate { get; set; } public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; } public DateTime DataModificationDate { get; set; }
public DateTime DataValidFrom { get; set; } public DateTime DataValidFrom { get; set; }
@ -24,8 +26,5 @@ namespace Gremlin.GremlinData.EntityClasses
public uint DataVersionNumber { get; set; } public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; } public string DataVersionComment { get; set; }
public string DataStatus { get; set; } public string DataStatus { get; set; }
//class properties:
public string SubMarketDescription { get; set; }
} }
} }

@ -9,8 +9,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Gremlin.Migrations namespace Gremlin.Migrations
{ {
[DbContext(typeof(GremlinContext))] [DbContext(typeof(GremlinContext))]
[Migration("20210611102249_InitialCreate")] [Migration("20210628082005_GremlinDb_0.1.0_MVP")]
partial class InitialCreate partial class GremlinDb_010_MVP
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
@ -25,7 +25,7 @@ namespace Gremlin.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int unsigned"); .HasColumnType("int unsigned");
b.Property<DateTime>("AccountCreatedinSAPOn") b.Property<DateTime>("AccountCreatedInSAPOn")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<string>("AccountName") b.Property<string>("AccountName")
@ -103,8 +103,8 @@ namespace Gremlin.Migrations
b.Property<string>("Notes") b.Property<string>("Notes")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int?>("ParentAccountId") b.Property<uint?>("ParentAccountId")
.HasColumnType("int"); .HasColumnType("int unsigned");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.IsRequired() .IsRequired()
@ -274,9 +274,6 @@ namespace Gremlin.Migrations
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("LinkToSAP")
.HasColumnType("longtext");
b.Property<string>("MobileNumber") b.Property<string>("MobileNumber")
.HasColumnType("longtext"); .HasColumnType("longtext");
@ -396,15 +393,12 @@ namespace Gremlin.Migrations
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("Note") b.Property<string>("Notes")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("OptionNumber") b.Property<string>("OptionNumber")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<uint>("ProductId")
.HasColumnType("int unsigned");
b.Property<string>("ProductNumber") b.Property<string>("ProductNumber")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
@ -413,15 +407,13 @@ namespace Gremlin.Migrations
b.HasIndex("AccountId"); b.HasIndex("AccountId");
b.HasIndex("ProductId")
.IsUnique();
b.ToTable("CustomDescriptions"); b.ToTable("CustomDescriptions");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.LineItem", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.LineItem", b =>
{ {
b.Property<uint>("QuoteId") b.Property<uint>("LineItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int unsigned"); .HasColumnType("int unsigned");
b.Property<ushort>("Amount") b.Property<ushort>("Amount")
@ -432,17 +424,46 @@ namespace Gremlin.Migrations
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
.HasDefaultValue(0m); .HasDefaultValue(0m);
b.Property<DateTime>("DataCreated") b.Property<DateTime>("DataCreationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("DataModified") b.Property<string>("DataModificationByUser")
.ValueGeneratedOnAdd()
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
b.Property<DateTime>("DataModificationDate")
.IsConcurrencyToken() .IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
b.Property<string>("DataStatus")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("DataValidFrom")
.ValueGeneratedOnAdd()
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("DataValidUntil")
.ValueGeneratedOnAdd()
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'");
b.Property<string>("DataVersionComment")
.ValueGeneratedOnAdd()
.HasColumnType("longtext")
.HasDefaultValue("");
b.Property<uint>("DataVersionNumber")
.ValueGeneratedOnAdd()
.HasColumnType("int unsigned")
.HasDefaultValue(1u);
b.Property<decimal>("DemoDiscount") b.Property<decimal>("DemoDiscount")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
@ -451,9 +472,6 @@ namespace Gremlin.Migrations
b.Property<decimal>("ExtendedListPrice") b.Property<decimal>("ExtendedListPrice")
.HasColumnType("decimal(65,30)"); .HasColumnType("decimal(65,30)");
b.Property<uint>("LineItemId")
.HasColumnType("int unsigned");
b.Property<decimal>("ListPrice") b.Property<decimal>("ListPrice")
.HasColumnType("decimal(65,30)"); .HasColumnType("decimal(65,30)");
@ -478,6 +496,9 @@ namespace Gremlin.Migrations
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
.HasDefaultValue(0m); .HasDefaultValue(0m);
b.Property<uint>("QuoteId")
.HasColumnType("int unsigned");
b.Property<decimal>("SalesDiscount") b.Property<decimal>("SalesDiscount")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
@ -497,7 +518,9 @@ namespace Gremlin.Migrations
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
.HasDefaultValue(0m); .HasDefaultValue(0m);
b.HasKey("QuoteId"); b.HasKey("LineItemId");
b.HasIndex("QuoteId");
b.ToTable("LineItems"); b.ToTable("LineItems");
}); });
@ -514,13 +537,16 @@ namespace Gremlin.Migrations
b.Property<int>("BreakRangeTo") b.Property<int>("BreakRangeTo")
.HasColumnType("int"); .HasColumnType("int");
b.Property<uint>("CustomDescriptionId")
.HasColumnType("int unsigned");
b.Property<DateTime>("DataCreationDate") b.Property<DateTime>("DataCreationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("DataModificationByUser") b.Property<string>("DataModificationByUser")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAdd()
.HasColumnType("TINYTEXT") .HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()"); .HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
@ -566,8 +592,9 @@ namespace Gremlin.Migrations
b.Property<string>("OptionNumber") b.Property<string>("OptionNumber")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<uint?>("ProductLineId") b.Property<string>("ProductLineCode")
.HasColumnType("int unsigned"); .IsRequired()
.HasColumnType("varchar(255)");
b.Property<string>("ProductNumber") b.Property<string>("ProductNumber")
.IsRequired() .IsRequired()
@ -587,16 +614,17 @@ namespace Gremlin.Migrations
b.HasKey("ProductId"); b.HasKey("ProductId");
b.HasIndex("ProductLineId"); b.HasIndex("CustomDescriptionId");
b.HasIndex("ProductLineCode");
b.ToTable("Products"); b.ToTable("Products");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.ProductLine", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.ProductLine", b =>
{ {
b.Property<uint>("ProductLineId") b.Property<string>("ProductLineCode")
.ValueGeneratedOnAdd() .HasColumnType("varchar(255)");
.HasColumnType("int unsigned");
b.Property<DateTime>("DataCreationDate") b.Property<DateTime>("DataCreationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -638,13 +666,10 @@ namespace Gremlin.Migrations
.HasColumnType("int unsigned") .HasColumnType("int unsigned")
.HasDefaultValue(1u); .HasDefaultValue(1u);
b.Property<string>("ProductLineAbbreviation")
.HasColumnType("longtext");
b.Property<string>("ProductLineDescription") b.Property<string>("ProductLineDescription")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.HasKey("ProductLineId"); b.HasKey("ProductLineCode");
b.ToTable("ProductLines"); b.ToTable("ProductLines");
}); });
@ -655,17 +680,46 @@ namespace Gremlin.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int unsigned"); .HasColumnType("int unsigned");
b.Property<DateTime>("DataCreated") b.Property<DateTime>("DataCreationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("DataModified") b.Property<string>("DataModificationByUser")
.ValueGeneratedOnAdd()
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
b.Property<DateTime>("DataModificationDate")
.IsConcurrencyToken() .IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
b.Property<string>("DataStatus")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("DataValidFrom")
.ValueGeneratedOnAdd()
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("DataValidUntil")
.ValueGeneratedOnAdd()
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'");
b.Property<string>("DataVersionComment")
.ValueGeneratedOnAdd()
.HasColumnType("longtext")
.HasDefaultValue("");
b.Property<uint>("DataVersionNumber")
.ValueGeneratedOnAdd()
.HasColumnType("int unsigned")
.HasDefaultValue(1u);
b.Property<DateTime>("QuotationDate") b.Property<DateTime>("QuotationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
@ -852,13 +906,13 @@ namespace Gremlin.Migrations
b.HasOne("Gremlin.GremlinData.EntityClasses.AccountType", "AccountType") b.HasOne("Gremlin.GremlinData.EntityClasses.AccountType", "AccountType")
.WithMany("Accounts") .WithMany("Accounts")
.HasForeignKey("AccountTypeCode") .HasForeignKey("AccountTypeCode")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
b.HasOne("Gremlin.GremlinData.EntityClasses.SubMarket", "SubMarket") b.HasOne("Gremlin.GremlinData.EntityClasses.SubMarket", "SubMarket")
.WithMany("Accounts") .WithMany("Accounts")
.HasForeignKey("SubMarketCode") .HasForeignKey("SubMarketCode")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
b.Navigation("AccountType"); b.Navigation("AccountType");
@ -880,19 +934,11 @@ namespace Gremlin.Migrations
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.CustomDescription", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.CustomDescription", b =>
{ {
b.HasOne("Gremlin.GremlinData.EntityClasses.Account", "Supplier") b.HasOne("Gremlin.GremlinData.EntityClasses.Account", "Supplier")
.WithMany() .WithMany("CustomDescriptions")
.HasForeignKey("AccountId") .HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Gremlin.GremlinData.EntityClasses.Product", "Product")
.WithOne("CustomDescription")
.HasForeignKey("Gremlin.GremlinData.EntityClasses.CustomDescription", "ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Supplier"); b.Navigation("Supplier");
}); });
@ -909,9 +955,18 @@ namespace Gremlin.Migrations
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Product", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Product", b =>
{ {
b.HasOne("Gremlin.GremlinData.EntityClasses.CustomDescription", "CustomDescription")
.WithMany("Products")
.HasForeignKey("CustomDescriptionId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("Gremlin.GremlinData.EntityClasses.ProductLine", "ProductLine") b.HasOne("Gremlin.GremlinData.EntityClasses.ProductLine", "ProductLine")
.WithMany("Products") .WithMany("Products")
.HasForeignKey("ProductLineId"); .HasForeignKey("ProductLineCode")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomDescription");
b.Navigation("ProductLine"); b.Navigation("ProductLine");
}); });
@ -919,7 +974,7 @@ namespace Gremlin.Migrations
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Quote", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Quote", b =>
{ {
b.HasOne("Gremlin.GremlinData.EntityClasses.Contact", "Recipient") b.HasOne("Gremlin.GremlinData.EntityClasses.Contact", "Recipient")
.WithMany() .WithMany("Quotes")
.HasForeignKey("RecipientContactId"); .HasForeignKey("RecipientContactId");
b.Navigation("Recipient"); b.Navigation("Recipient");
@ -939,6 +994,8 @@ namespace Gremlin.Migrations
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Account", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Account", b =>
{ {
b.Navigation("Contacts"); b.Navigation("Contacts");
b.Navigation("CustomDescriptions");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.AccountType", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.AccountType", b =>
@ -946,9 +1003,14 @@ namespace Gremlin.Migrations
b.Navigation("Accounts"); b.Navigation("Accounts");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Product", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Contact", b =>
{ {
b.Navigation("CustomDescription"); b.Navigation("Quotes");
});
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.CustomDescription", b =>
{
b.Navigation("Products");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.ProductLine", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.ProductLine", b =>

@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Gremlin.Migrations namespace Gremlin.Migrations
{ {
public partial class InitialCreate : Migration public partial class GremlinDb_010_MVP : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -17,6 +17,8 @@ namespace Gremlin.Migrations
{ {
AccountTypeCode = table.Column<string>(type: "Char(3)", nullable: false) AccountTypeCode = table.Column<string>(type: "Char(3)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
AccountTypeDescription = table.Column<string>(type: "Varchar(1000)", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
@ -27,8 +29,6 @@ namespace Gremlin.Migrations
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "") DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false) DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AccountTypeDescription = table.Column<string>(type: "Varchar(1000)", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4") .Annotation("MySql:CharSet", "utf8mb4")
}, },
constraints: table => constraints: table =>
@ -41,8 +41,10 @@ namespace Gremlin.Migrations
name: "ProductLines", name: "ProductLines",
columns: table => new columns: table => new
{ {
ProductLineId = table.Column<uint>(type: "int unsigned", nullable: false) ProductLineCode = table.Column<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:CharSet", "utf8mb4"),
ProductLineDescription = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
@ -53,15 +55,11 @@ namespace Gremlin.Migrations
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "") DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false) DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProductLineAbbreviation = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
ProductLineDescription = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4") .Annotation("MySql:CharSet", "utf8mb4")
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ProductLines", x => x.ProductLineId); table.PrimaryKey("PK_ProductLines", x => x.ProductLineCode);
}) })
.Annotation("MySql:CharSet", "utf8mb4"); .Annotation("MySql:CharSet", "utf8mb4");
@ -71,13 +69,13 @@ namespace Gremlin.Migrations
{ {
RegisteredUserID = table.Column<uint>(type: "int unsigned", nullable: false) RegisteredUserID = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
UserName = table.Column<string>(type: "longtext", nullable: false) UserName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
PasswordHash = table.Column<string>(type: "longtext", nullable: false) PasswordHash = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4") .Annotation("MySql:CharSet", "utf8mb4")
}, },
constraints: table => constraints: table =>
@ -92,6 +90,8 @@ namespace Gremlin.Migrations
{ {
SubMarketCode = table.Column<string>(type: "Char(3)", nullable: false) SubMarketCode = table.Column<string>(type: "Char(3)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
SubMarketDescription = table.Column<string>(type: "Varchar(1000)", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
@ -102,8 +102,6 @@ namespace Gremlin.Migrations
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "") DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false) DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SubMarketDescription = table.Column<string>(type: "Varchar(1000)", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4") .Annotation("MySql:CharSet", "utf8mb4")
}, },
constraints: table => constraints: table =>
@ -112,53 +110,6 @@ namespace Gremlin.Migrations
}) })
.Annotation("MySql:CharSet", "utf8mb4"); .Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
ProductId = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProductLineId = table.Column<uint>(type: "int unsigned", nullable: true),
ProductNumber = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
OptionNumber = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
SapShortDescription = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
SapLongDescription = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Weight = table.Column<float>(type: "float", nullable: false),
ProductStatus = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IntroductionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
ListPrice = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
HasBreakPrices = table.Column<bool>(type: "tinyint(1)", nullable: false),
BreakRangeFrom = table.Column<int>(type: "int", nullable: false),
BreakRangeTo = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.ProductId);
table.ForeignKey(
name: "FK_Products_ProductLines_ProductLineId",
column: x => x.ProductLineId,
principalTable: "ProductLines",
principalColumn: "ProductLineId",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "RUSettings", name: "RUSettings",
columns: table => new columns: table => new
@ -166,13 +117,13 @@ namespace Gremlin.Migrations
RUSettingsID = table.Column<uint>(type: "int unsigned", nullable: false) RUSettingsID = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
RegisteredUserID = table.Column<uint>(type: "int unsigned", nullable: false), RegisteredUserID = table.Column<uint>(type: "int unsigned", nullable: false),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
SettingKey = table.Column<string>(type: "longtext", nullable: false) SettingKey = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
SettingValue = table.Column<string>(type: "longtext", nullable: false) SettingValue = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4") .Annotation("MySql:CharSet", "utf8mb4")
}, },
constraints: table => constraints: table =>
@ -193,22 +144,11 @@ namespace Gremlin.Migrations
{ {
AccountId = table.Column<uint>(type: "int unsigned", nullable: false) AccountId = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ParentAccountId = table.Column<int>(type: "int", nullable: true), ParentAccountId = table.Column<uint>(type: "int unsigned", nullable: true),
AccountTypeCode = table.Column<string>(type: "Char(3)", nullable: false) AccountTypeCode = table.Column<string>(type: "Char(3)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
SubMarketCode = table.Column<string>(type: "Char(3)", nullable: false) SubMarketCode = table.Column<string>(type: "Char(3)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AccountName = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) AccountName = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
Notes = table.Column<string>(type: "longtext", nullable: true) Notes = table.Column<string>(type: "longtext", nullable: true)
@ -232,7 +172,18 @@ namespace Gremlin.Migrations
EMail = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: true) EMail = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
SAPAccountNumber = table.Column<uint>(type: "int unsigned", nullable: false), SAPAccountNumber = table.Column<uint>(type: "int unsigned", nullable: false),
AccountCreatedinSAPOn = table.Column<DateTime>(type: "datetime(6)", nullable: false) AccountCreatedInSAPOn = table.Column<DateTime>(type: "datetime(6)", nullable: false),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
}, },
constraints: table => constraints: table =>
{ {
@ -243,13 +194,13 @@ namespace Gremlin.Migrations
column: x => x.AccountTypeCode, column: x => x.AccountTypeCode,
principalTable: "AccountTypes", principalTable: "AccountTypes",
principalColumn: "AccountTypeCode", principalColumn: "AccountTypeCode",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Restrict);
table.ForeignKey( table.ForeignKey(
name: "FK_Accounts_SubMarkets_SubMarketCode", name: "FK_Accounts_SubMarkets_SubMarketCode",
column: x => x.SubMarketCode, column: x => x.SubMarketCode,
principalTable: "SubMarkets", principalTable: "SubMarkets",
principalColumn: "SubMarketCode", principalColumn: "SubMarketCode",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Restrict);
}) })
.Annotation("MySql:CharSet", "utf8mb4"); .Annotation("MySql:CharSet", "utf8mb4");
@ -260,17 +211,6 @@ namespace Gremlin.Migrations
ContactId = table.Column<uint>(type: "int unsigned", nullable: false) ContactId = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
AccountId = table.Column<uint>(type: "int unsigned", nullable: false), AccountId = table.Column<uint>(type: "int unsigned", nullable: false),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AcademicTitle = table.Column<string>(type: "longtext", nullable: true) AcademicTitle = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
FirstName = table.Column<string>(type: "longtext", nullable: true) FirstName = table.Column<string>(type: "longtext", nullable: true)
@ -313,7 +253,16 @@ namespace Gremlin.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
SAPCompetitiveIBase = table.Column<string>(type: "longtext", nullable: true) SAPCompetitiveIBase = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
LinkToSAP = table.Column<string>(type: "longtext", nullable: true) DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4") .Annotation("MySql:CharSet", "utf8mb4")
}, },
constraints: table => constraints: table =>
@ -334,19 +283,7 @@ namespace Gremlin.Migrations
{ {
CustomDescriptionId = table.Column<uint>(type: "int unsigned", nullable: false) CustomDescriptionId = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ProductId = table.Column<uint>(type: "int unsigned", nullable: false),
AccountId = table.Column<uint>(type: "int unsigned", nullable: false), AccountId = table.Column<uint>(type: "int unsigned", nullable: false),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProductNumber = table.Column<string>(type: "longtext", nullable: false) ProductNumber = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
OptionNumber = table.Column<string>(type: "longtext", nullable: true) OptionNumber = table.Column<string>(type: "longtext", nullable: true)
@ -357,7 +294,18 @@ namespace Gremlin.Migrations
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
CoverletterText = table.Column<string>(type: "longtext", nullable: true) CoverletterText = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
Note = table.Column<string>(type: "longtext", nullable: true) Notes = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4") .Annotation("MySql:CharSet", "utf8mb4")
}, },
constraints: table => constraints: table =>
@ -369,12 +317,6 @@ namespace Gremlin.Migrations
principalTable: "Accounts", principalTable: "Accounts",
principalColumn: "AccountId", principalColumn: "AccountId",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CustomDescriptions_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "ProductId",
onDelete: ReferentialAction.Cascade);
}) })
.Annotation("MySql:CharSet", "utf8mb4"); .Annotation("MySql:CharSet", "utf8mb4");
@ -384,15 +326,13 @@ namespace Gremlin.Migrations
{ {
QuoteId = table.Column<uint>(type: "int unsigned", nullable: false) QuoteId = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
DataCreated = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), RecipientContactId = table.Column<uint>(type: "int unsigned", nullable: true),
DataModified = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
QuotationNumber = table.Column<string>(type: "VARCHAR(255)", nullable: false) QuotationNumber = table.Column<string>(type: "VARCHAR(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
QuotationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false) QuotationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ValidUntil = table.Column<DateTime>(type: "datetime(6)", nullable: false), ValidUntil = table.Column<DateTime>(type: "datetime(6)", nullable: false),
ValidFor = table.Column<byte>(type: "tinyint unsigned", nullable: false), ValidFor = table.Column<byte>(type: "tinyint unsigned", nullable: false),
RecipientContactId = table.Column<uint>(type: "int unsigned", nullable: true),
TotalListprice = table.Column<decimal>(type: "decimal(65,30)", nullable: false), TotalListprice = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
TotalDiscount = table.Column<decimal>(type: "decimal(65,30)", nullable: false), TotalDiscount = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
TotalNet = table.Column<decimal>(type: "decimal(65,30)", nullable: false), TotalNet = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
@ -401,7 +341,18 @@ namespace Gremlin.Migrations
QuoteContains3PP = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), QuoteContains3PP = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
QuoteContainsRB = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), QuoteContainsRB = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
QuoteTemplate = table.Column<string>(type: "longtext", nullable: true) QuoteTemplate = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4") .Annotation("MySql:CharSet", "utf8mb4"),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u)
}, },
constraints: table => constraints: table =>
{ {
@ -415,14 +366,68 @@ namespace Gremlin.Migrations
}) })
.Annotation("MySql:CharSet", "utf8mb4"); .Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
ProductId = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CustomDescriptionId = table.Column<uint>(type: "int unsigned", nullable: false),
ProductLineCode = table.Column<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProductNumber = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
OptionNumber = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
SapShortDescription = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
SapLongDescription = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Weight = table.Column<float>(type: "float", nullable: false),
ProductStatus = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IntroductionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
ListPrice = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
HasBreakPrices = table.Column<bool>(type: "tinyint(1)", nullable: false),
BreakRangeFrom = table.Column<int>(type: "int", nullable: false),
BreakRangeTo = table.Column<int>(type: "int", nullable: false),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.ProductId);
table.ForeignKey(
name: "FK_Products_CustomDescriptions_CustomDescriptionId",
column: x => x.CustomDescriptionId,
principalTable: "CustomDescriptions",
principalColumn: "CustomDescriptionId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Products_ProductLines_ProductLineCode",
column: x => x.ProductLineCode,
principalTable: "ProductLines",
principalColumn: "ProductLineCode",
onDelete: ReferentialAction.Restrict);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "LineItems", name: "LineItems",
columns: table => new columns: table => new
{ {
LineItemId = table.Column<uint>(type: "int unsigned", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
QuoteId = table.Column<uint>(type: "int unsigned", nullable: false), QuoteId = table.Column<uint>(type: "int unsigned", nullable: false),
LineItemId = table.Column<uint>(type: "int unsigned", nullable: false),
DataCreated = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModified = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
Position = table.Column<ushort>(type: "smallint unsigned", nullable: false), Position = table.Column<ushort>(type: "smallint unsigned", nullable: false),
Amount = table.Column<ushort>(type: "smallint unsigned", nullable: false), Amount = table.Column<ushort>(type: "smallint unsigned", nullable: false),
ProductNumber = table.Column<string>(type: "longtext", nullable: false) ProductNumber = table.Column<string>(type: "longtext", nullable: false)
@ -443,11 +448,22 @@ namespace Gremlin.Migrations
ListPrice = table.Column<decimal>(type: "decimal(65,30)", nullable: false), ListPrice = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
ExtendedListPrice = table.Column<decimal>(type: "decimal(65,30)", nullable: false), ExtendedListPrice = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
NetPrice = table.Column<decimal>(type: "decimal(65,30)", nullable: false), NetPrice = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
Total = table.Column<decimal>(type: "decimal(65,30)", nullable: false) Total = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
DataCreationDate = table.Column<DateTime>(type: "TIMESTAMP", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataModificationByUser = table.Column<string>(type: "TINYTEXT", nullable: true, defaultValueSql: "ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()")
.Annotation("MySql:CharSet", "utf8mb4"),
DataModificationDate = table.Column<DateTime>(type: "TIMESTAMP", rowVersion: true, nullable: false, defaultValueSql: "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"),
DataStatus = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
DataValidFrom = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DataValidUntil = table.Column<DateTime>(type: "DATETIME", nullable: false, defaultValueSql: "'9999-12-31 23:59:59.000000'"),
DataVersionComment = table.Column<string>(type: "longtext", nullable: true, defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4"),
DataVersionNumber = table.Column<uint>(type: "int unsigned", nullable: false, defaultValue: 1u)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_LineItems", x => x.QuoteId); table.PrimaryKey("PK_LineItems", x => x.LineItemId);
table.ForeignKey( table.ForeignKey(
name: "FK_LineItems_Quotes_QuoteId", name: "FK_LineItems_Quotes_QuoteId",
column: x => x.QuoteId, column: x => x.QuoteId,
@ -478,15 +494,19 @@ namespace Gremlin.Migrations
column: "AccountId"); column: "AccountId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_CustomDescriptions_ProductId", name: "IX_LineItems_QuoteId",
table: "CustomDescriptions", table: "LineItems",
column: "ProductId", column: "QuoteId");
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Products_CustomDescriptionId",
table: "Products",
column: "CustomDescriptionId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Products_ProductLineId", name: "IX_Products_ProductLineCode",
table: "Products", table: "Products",
column: "ProductLineId"); column: "ProductLineCode");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Quotes_RecipientContactId", name: "IX_Quotes_RecipientContactId",
@ -501,27 +521,27 @@ namespace Gremlin.Migrations
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable(
name: "CustomDescriptions");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "LineItems"); name: "LineItems");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "RUSettings"); name: "Products");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Products"); name: "RUSettings");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Quotes"); name: "Quotes");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "RegisteredUser"); name: "CustomDescriptions");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ProductLines"); name: "ProductLines");
migrationBuilder.DropTable(
name: "RegisteredUser");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Contacts"); name: "Contacts");

@ -23,7 +23,7 @@ namespace Gremlin.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int unsigned"); .HasColumnType("int unsigned");
b.Property<DateTime>("AccountCreatedinSAPOn") b.Property<DateTime>("AccountCreatedInSAPOn")
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
b.Property<string>("AccountName") b.Property<string>("AccountName")
@ -101,8 +101,8 @@ namespace Gremlin.Migrations
b.Property<string>("Notes") b.Property<string>("Notes")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<int?>("ParentAccountId") b.Property<uint?>("ParentAccountId")
.HasColumnType("int"); .HasColumnType("int unsigned");
b.Property<string>("PhoneNumber") b.Property<string>("PhoneNumber")
.IsRequired() .IsRequired()
@ -272,9 +272,6 @@ namespace Gremlin.Migrations
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("LinkToSAP")
.HasColumnType("longtext");
b.Property<string>("MobileNumber") b.Property<string>("MobileNumber")
.HasColumnType("longtext"); .HasColumnType("longtext");
@ -394,15 +391,12 @@ namespace Gremlin.Migrations
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("Note") b.Property<string>("Notes")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<string>("OptionNumber") b.Property<string>("OptionNumber")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<uint>("ProductId")
.HasColumnType("int unsigned");
b.Property<string>("ProductNumber") b.Property<string>("ProductNumber")
.IsRequired() .IsRequired()
.HasColumnType("longtext"); .HasColumnType("longtext");
@ -411,15 +405,13 @@ namespace Gremlin.Migrations
b.HasIndex("AccountId"); b.HasIndex("AccountId");
b.HasIndex("ProductId")
.IsUnique();
b.ToTable("CustomDescriptions"); b.ToTable("CustomDescriptions");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.LineItem", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.LineItem", b =>
{ {
b.Property<uint>("QuoteId") b.Property<uint>("LineItemId")
.ValueGeneratedOnAdd()
.HasColumnType("int unsigned"); .HasColumnType("int unsigned");
b.Property<ushort>("Amount") b.Property<ushort>("Amount")
@ -430,17 +422,46 @@ namespace Gremlin.Migrations
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
.HasDefaultValue(0m); .HasDefaultValue(0m);
b.Property<DateTime>("DataCreated") b.Property<DateTime>("DataCreationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("DataModified") b.Property<string>("DataModificationByUser")
.ValueGeneratedOnAdd()
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
b.Property<DateTime>("DataModificationDate")
.IsConcurrencyToken() .IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
b.Property<string>("DataStatus")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("DataValidFrom")
.ValueGeneratedOnAdd()
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("DataValidUntil")
.ValueGeneratedOnAdd()
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'");
b.Property<string>("DataVersionComment")
.ValueGeneratedOnAdd()
.HasColumnType("longtext")
.HasDefaultValue("");
b.Property<uint>("DataVersionNumber")
.ValueGeneratedOnAdd()
.HasColumnType("int unsigned")
.HasDefaultValue(1u);
b.Property<decimal>("DemoDiscount") b.Property<decimal>("DemoDiscount")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
@ -449,9 +470,6 @@ namespace Gremlin.Migrations
b.Property<decimal>("ExtendedListPrice") b.Property<decimal>("ExtendedListPrice")
.HasColumnType("decimal(65,30)"); .HasColumnType("decimal(65,30)");
b.Property<uint>("LineItemId")
.HasColumnType("int unsigned");
b.Property<decimal>("ListPrice") b.Property<decimal>("ListPrice")
.HasColumnType("decimal(65,30)"); .HasColumnType("decimal(65,30)");
@ -476,6 +494,9 @@ namespace Gremlin.Migrations
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
.HasDefaultValue(0m); .HasDefaultValue(0m);
b.Property<uint>("QuoteId")
.HasColumnType("int unsigned");
b.Property<decimal>("SalesDiscount") b.Property<decimal>("SalesDiscount")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
@ -495,7 +516,9 @@ namespace Gremlin.Migrations
.HasColumnType("decimal(65,30)") .HasColumnType("decimal(65,30)")
.HasDefaultValue(0m); .HasDefaultValue(0m);
b.HasKey("QuoteId"); b.HasKey("LineItemId");
b.HasIndex("QuoteId");
b.ToTable("LineItems"); b.ToTable("LineItems");
}); });
@ -512,13 +535,16 @@ namespace Gremlin.Migrations
b.Property<int>("BreakRangeTo") b.Property<int>("BreakRangeTo")
.HasColumnType("int"); .HasColumnType("int");
b.Property<uint>("CustomDescriptionId")
.HasColumnType("int unsigned");
b.Property<DateTime>("DataCreationDate") b.Property<DateTime>("DataCreationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("DataModificationByUser") b.Property<string>("DataModificationByUser")
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAdd()
.HasColumnType("TINYTEXT") .HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()"); .HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
@ -564,8 +590,9 @@ namespace Gremlin.Migrations
b.Property<string>("OptionNumber") b.Property<string>("OptionNumber")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.Property<uint?>("ProductLineId") b.Property<string>("ProductLineCode")
.HasColumnType("int unsigned"); .IsRequired()
.HasColumnType("varchar(255)");
b.Property<string>("ProductNumber") b.Property<string>("ProductNumber")
.IsRequired() .IsRequired()
@ -585,16 +612,17 @@ namespace Gremlin.Migrations
b.HasKey("ProductId"); b.HasKey("ProductId");
b.HasIndex("ProductLineId"); b.HasIndex("CustomDescriptionId");
b.HasIndex("ProductLineCode");
b.ToTable("Products"); b.ToTable("Products");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.ProductLine", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.ProductLine", b =>
{ {
b.Property<uint>("ProductLineId") b.Property<string>("ProductLineCode")
.ValueGeneratedOnAdd() .HasColumnType("varchar(255)");
.HasColumnType("int unsigned");
b.Property<DateTime>("DataCreationDate") b.Property<DateTime>("DataCreationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -636,13 +664,10 @@ namespace Gremlin.Migrations
.HasColumnType("int unsigned") .HasColumnType("int unsigned")
.HasDefaultValue(1u); .HasDefaultValue(1u);
b.Property<string>("ProductLineAbbreviation")
.HasColumnType("longtext");
b.Property<string>("ProductLineDescription") b.Property<string>("ProductLineDescription")
.HasColumnType("longtext"); .HasColumnType("longtext");
b.HasKey("ProductLineId"); b.HasKey("ProductLineCode");
b.ToTable("ProductLines"); b.ToTable("ProductLines");
}); });
@ -653,17 +678,46 @@ namespace Gremlin.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("int unsigned"); .HasColumnType("int unsigned");
b.Property<DateTime>("DataCreated") b.Property<DateTime>("DataCreationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("DataModified") b.Property<string>("DataModificationByUser")
.ValueGeneratedOnAdd()
.HasColumnType("TINYTEXT")
.HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
b.Property<DateTime>("DataModificationDate")
.IsConcurrencyToken() .IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
.HasColumnType("TIMESTAMP") .HasColumnType("TIMESTAMP")
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); .HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
b.Property<string>("DataStatus")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("DataValidFrom")
.ValueGeneratedOnAdd()
.HasColumnType("DATETIME")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("DataValidUntil")
.ValueGeneratedOnAdd()
.HasColumnType("DATETIME")
.HasDefaultValueSql("'9999-12-31 23:59:59.000000'");
b.Property<string>("DataVersionComment")
.ValueGeneratedOnAdd()
.HasColumnType("longtext")
.HasDefaultValue("");
b.Property<uint>("DataVersionNumber")
.ValueGeneratedOnAdd()
.HasColumnType("int unsigned")
.HasDefaultValue(1u);
b.Property<DateTime>("QuotationDate") b.Property<DateTime>("QuotationDate")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime(6)"); .HasColumnType("datetime(6)");
@ -850,13 +904,13 @@ namespace Gremlin.Migrations
b.HasOne("Gremlin.GremlinData.EntityClasses.AccountType", "AccountType") b.HasOne("Gremlin.GremlinData.EntityClasses.AccountType", "AccountType")
.WithMany("Accounts") .WithMany("Accounts")
.HasForeignKey("AccountTypeCode") .HasForeignKey("AccountTypeCode")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
b.HasOne("Gremlin.GremlinData.EntityClasses.SubMarket", "SubMarket") b.HasOne("Gremlin.GremlinData.EntityClasses.SubMarket", "SubMarket")
.WithMany("Accounts") .WithMany("Accounts")
.HasForeignKey("SubMarketCode") .HasForeignKey("SubMarketCode")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Restrict)
.IsRequired(); .IsRequired();
b.Navigation("AccountType"); b.Navigation("AccountType");
@ -878,19 +932,11 @@ namespace Gremlin.Migrations
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.CustomDescription", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.CustomDescription", b =>
{ {
b.HasOne("Gremlin.GremlinData.EntityClasses.Account", "Supplier") b.HasOne("Gremlin.GremlinData.EntityClasses.Account", "Supplier")
.WithMany() .WithMany("CustomDescriptions")
.HasForeignKey("AccountId") .HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Gremlin.GremlinData.EntityClasses.Product", "Product")
.WithOne("CustomDescription")
.HasForeignKey("Gremlin.GremlinData.EntityClasses.CustomDescription", "ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Product");
b.Navigation("Supplier"); b.Navigation("Supplier");
}); });
@ -907,9 +953,18 @@ namespace Gremlin.Migrations
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Product", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Product", b =>
{ {
b.HasOne("Gremlin.GremlinData.EntityClasses.CustomDescription", "CustomDescription")
.WithMany("Products")
.HasForeignKey("CustomDescriptionId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("Gremlin.GremlinData.EntityClasses.ProductLine", "ProductLine") b.HasOne("Gremlin.GremlinData.EntityClasses.ProductLine", "ProductLine")
.WithMany("Products") .WithMany("Products")
.HasForeignKey("ProductLineId"); .HasForeignKey("ProductLineCode")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("CustomDescription");
b.Navigation("ProductLine"); b.Navigation("ProductLine");
}); });
@ -917,7 +972,7 @@ namespace Gremlin.Migrations
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Quote", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Quote", b =>
{ {
b.HasOne("Gremlin.GremlinData.EntityClasses.Contact", "Recipient") b.HasOne("Gremlin.GremlinData.EntityClasses.Contact", "Recipient")
.WithMany() .WithMany("Quotes")
.HasForeignKey("RecipientContactId"); .HasForeignKey("RecipientContactId");
b.Navigation("Recipient"); b.Navigation("Recipient");
@ -937,6 +992,8 @@ namespace Gremlin.Migrations
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Account", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Account", b =>
{ {
b.Navigation("Contacts"); b.Navigation("Contacts");
b.Navigation("CustomDescriptions");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.AccountType", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.AccountType", b =>
@ -944,9 +1001,14 @@ namespace Gremlin.Migrations
b.Navigation("Accounts"); b.Navigation("Accounts");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Product", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.Contact", b =>
{ {
b.Navigation("CustomDescription"); b.Navigation("Quotes");
});
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.CustomDescription", b =>
{
b.Navigation("Products");
}); });
modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.ProductLine", b => modelBuilder.Entity("Gremlin.GremlinData.EntityClasses.ProductLine", b =>