From e4677b1aea8380b493f0467d7ba5b15a2b0baf26 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Wed, 8 Oct 2025 11:38:42 +0100 Subject: [PATCH] Migration added and updated --- ...0251008103414_InitialDatabase.Designer.cs} | 835 ++++++++++++----- ...e.cs => 20251008103414_InitialDatabase.cs} | 883 +++++++++++------- .../PyroFetesDbContextModelSnapshot.cs | 833 ++++++++++++----- PyroFetes/Models/MaterialWarehouse.cs | 2 + PyroFetes/PyroFetesDbContext.cs | 12 + 5 files changed, 1763 insertions(+), 802 deletions(-) rename PyroFetes/Migrations/{20251007094021_InitialDatabase.Designer.cs => 20251008103414_InitialDatabase.Designer.cs} (71%) rename PyroFetes/Migrations/{20251007094021_InitialDatabase.cs => 20251008103414_InitialDatabase.cs} (79%) diff --git a/PyroFetes/Migrations/20251007094021_InitialDatabase.Designer.cs b/PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs similarity index 71% rename from PyroFetes/Migrations/20251007094021_InitialDatabase.Designer.cs rename to PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs index 7b2ce88..8e971b2 100644 --- a/PyroFetes/Migrations/20251007094021_InitialDatabase.Designer.cs +++ b/PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs @@ -12,7 +12,7 @@ using PyroFetes; namespace PyroFetes.Migrations { [DbContext(typeof(PyroFetesDbContext))] - [Migration("20251007094021_InitialDatabase")] + [Migration("20251008103414_InitialDatabase")] partial class InitialDatabase { /// @@ -33,9 +33,8 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("AvailabilityDate") - .IsRequired() - .HasColumnType("nvarchar(max)"); + b.Property("AvailabilityDate") + .HasColumnType("date"); b.Property("DeliveryDate") .HasColumnType("date"); @@ -74,6 +73,27 @@ namespace PyroFetes.Migrations b.ToTable("Brands"); }); + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("City"); + }); + modelBuilder.Entity("PyroFetes.Models.Classification", b => { b.Property("Id") @@ -84,7 +104,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -101,7 +122,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -118,18 +140,26 @@ namespace PyroFetes.Migrations b.Property("Calling") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ContactId") + .HasColumnType("int"); b.Property("Email") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Meeting") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); b.HasKey("Id"); + b.HasIndex("ContactId"); + b.ToTable("Communications"); }); @@ -143,18 +173,21 @@ namespace PyroFetes.Migrations b.Property("Address") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("City") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("CommunicationId") + b.Property("CustomerId") .HasColumnType("int"); b.Property("Email") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("FirstName") .IsRequired() @@ -168,23 +201,58 @@ namespace PyroFetes.Migrations b.Property("PhoneNumber") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); b.Property("Role") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("ZipCode") - .IsRequired() - .HasColumnType("nvarchar(max)"); + b.Property("ZipCode") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("CommunicationId"); + b.HasIndex("CustomerId"); b.ToTable("Contacts"); }); + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("ContactServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.Property("TermsAndConditions") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ShowId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("Contract"); + }); + modelBuilder.Entity("PyroFetes.Models.Customer", b => { b.Property("Id") @@ -193,40 +261,21 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("ContactId") - .HasColumnType("int"); - b.Property("CustomerTypeId") .HasColumnType("int"); b.Property("Note") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); - b.HasIndex("ContactId"); - b.HasIndex("CustomerTypeId"); b.ToTable("Customers"); }); - modelBuilder.Entity("PyroFetes.Models.CustomerContact", b => - { - b.Property("ContactId") - .HasColumnType("int"); - - b.Property("CustomerId") - .HasColumnType("int"); - - b.HasKey("ContactId", "CustomerId"); - - b.HasIndex("CustomerId"); - - b.ToTable("CustomerContacts"); - }); - modelBuilder.Entity("PyroFetes.Models.CustomerType", b => { b.Property("Id") @@ -235,8 +284,10 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("Price") - .HasColumnType("decimal(18,2)"); + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -253,7 +304,8 @@ namespace PyroFetes.Migrations b.Property("Transporter") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -282,7 +334,8 @@ namespace PyroFetes.Migrations b.Property("TrackingNumber") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -301,7 +354,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -318,10 +372,16 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("StaffId") + .HasColumnType("int"); b.HasKey("Id"); + b.HasIndex("StaffId"); + b.ToTable("ExperienceLevels"); }); @@ -370,6 +430,21 @@ namespace PyroFetes.Migrations b.ToTable("Materials"); }); + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.Property("MaterialId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("MaterialId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("MaterialWarehouse"); + }); + modelBuilder.Entity("PyroFetes.Models.Movement", b => { b.Property("Id") @@ -387,9 +462,6 @@ namespace PyroFetes.Migrations b.Property("DestinationWarehouseId") .HasColumnType("int"); - b.Property("ProductId") - .HasColumnType("int"); - b.Property("Quantity") .HasColumnType("int"); @@ -403,8 +475,6 @@ namespace PyroFetes.Migrations b.HasIndex("DestinationWarehouseId"); - b.HasIndex("ProductId"); - b.HasIndex("SourceWarehouseId"); b.ToTable("Movements"); @@ -454,11 +524,15 @@ namespace PyroFetes.Migrations b.Property("Link") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("MinimalQuantity") .HasColumnType("int"); + b.Property("MovementId") + .HasColumnType("int"); + b.Property("Name") .IsRequired() .HasMaxLength(100) @@ -483,6 +557,8 @@ namespace PyroFetes.Migrations b.HasIndex("ClassificationId"); + b.HasIndex("MovementId"); + b.HasIndex("ProductCategoryId"); b.ToTable("Products"); @@ -498,7 +574,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -553,28 +630,25 @@ namespace PyroFetes.Migrations b.ToTable("ProductEffects"); }); - modelBuilder.Entity("PyroFetes.Models.Provider", b => + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => { - b.Property("Id") - .ValueGeneratedOnAdd() + b.Property("ProductId") .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + b.Property("ShowId") + .HasColumnType("int"); - b.Property("Price") + b.Property("End") .HasColumnType("decimal(18,2)"); - b.Property("ProviderId") - .HasColumnType("int"); + b.Property("Start") + .HasColumnType("decimal(18,2)"); - b.Property("ProviderTypeId") - .HasColumnType("int"); + b.HasKey("ProductId", "ShowId"); - b.HasKey("Id"); + b.HasIndex("ShowId"); - b.HasIndex("ProviderTypeId"); - - b.ToTable("Providers"); + b.ToTable("ProductTimecode"); }); modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => @@ -602,7 +676,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -619,7 +694,8 @@ namespace PyroFetes.Migrations b.Property("PurchaseConditions") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); b.HasKey("Id"); @@ -654,14 +730,21 @@ namespace PyroFetes.Migrations b.Property("ConditionsSale") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("CustomerId") + .HasColumnType("int"); b.Property("Message") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); + b.HasIndex("CustomerId"); + b.ToTable("Quotations"); }); @@ -683,6 +766,27 @@ namespace PyroFetes.Migrations b.ToTable("QuotationProducts"); }); + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("ProviderTypeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProviderTypeId"); + + b.ToTable("Providers"); + }); + modelBuilder.Entity("PyroFetes.Models.Setting", b => { b.Property("Id") @@ -712,8 +816,11 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("Date") - .HasColumnType("datetime2"); + b.Property("CityId") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("date"); b.Property("Description") .HasMaxLength(500) @@ -721,7 +828,8 @@ namespace PyroFetes.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Place") .IsRequired() @@ -735,9 +843,56 @@ namespace PyroFetes.Migrations b.HasKey("Id"); + b.HasIndex("CityId"); + b.ToTable("Shows"); }); + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("MaterialId") + .HasColumnType("int"); + + b.HasKey("ShowId", "MaterialId"); + + b.HasIndex("MaterialId"); + + b.ToTable("ShowMaterial"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.Property("StaffId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.HasKey("StaffId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ShowStaff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("TruckId") + .HasColumnType("int"); + + b.HasKey("ShowId", "TruckId"); + + b.HasIndex("TruckId"); + + b.ToTable("ShowTruck"); + }); + modelBuilder.Entity("PyroFetes.Models.Sound", b => { b.Property("Id") @@ -798,8 +953,8 @@ namespace PyroFetes.Migrations b.Property("Name") .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -808,27 +963,19 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("End") - .HasColumnType("int"); - b.Property("ShowId") .HasColumnType("int"); b.Property("SoundId") .HasColumnType("int"); - b.Property("Start") - .HasColumnType("int"); + b.Property("End") + .HasColumnType("decimal(18,2)"); - b.HasKey("Id"); + b.Property("Start") + .HasColumnType("decimal(18,2)"); - b.HasIndex("ShowId"); + b.HasKey("ShowId", "SoundId"); b.HasIndex("SoundId"); @@ -853,7 +1000,8 @@ namespace PyroFetes.Migrations b.Property("F4T2NumberApproval") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("FirstName") .IsRequired() @@ -930,18 +1078,21 @@ namespace PyroFetes.Migrations b.Property("Address") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("City") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("DeliveryDelay") .HasColumnType("int"); b.Property("Email") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Name") .IsRequired() @@ -950,7 +1101,8 @@ namespace PyroFetes.Migrations b.Property("Phone") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); b.Property("ZipCode") .HasColumnType("int"); @@ -969,11 +1121,9 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("MaxExplosiveCapacity") + .IsRequired() .HasColumnType("float"); - b.Property("ShowId") - .HasColumnType("int"); - b.Property("Sizes") .IsRequired() .HasMaxLength(80) @@ -991,8 +1141,6 @@ namespace PyroFetes.Migrations b.HasKey("Id"); - b.HasIndex("ShowId"); - b.ToTable("Trucks"); }); @@ -1006,11 +1154,13 @@ namespace PyroFetes.Migrations b.Property("Email") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Fonction") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Name") .IsRequired() @@ -1019,11 +1169,13 @@ namespace PyroFetes.Migrations b.Property("Password") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.Property("Salt") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -1040,11 +1192,13 @@ namespace PyroFetes.Migrations b.Property("Address") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("City") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Current") .HasColumnType("int"); @@ -1070,42 +1224,22 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => { - b.Property("Quantity") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Quantity")); - b.Property("ProductId") .HasColumnType("int"); b.Property("WarehouseId") .HasColumnType("int"); - b.HasKey("Quantity"); + b.Property("Quantity") + .HasColumnType("int"); - b.HasIndex("ProductId"); + b.HasKey("ProductId", "WarehouseId"); b.HasIndex("WarehouseId"); b.ToTable("WarehouseProducts"); }); - modelBuilder.Entity("ShowStaff", b => - { - b.Property("ShowsId") - .HasColumnType("int"); - - b.Property("StaffId") - .HasColumnType("int"); - - b.HasKey("ShowsId", "StaffId"); - - b.HasIndex("StaffId"); - - b.ToTable("ShowStaff"); - }); - modelBuilder.Entity("PyroFetes.Models.Brand", b => { b.HasOne("PyroFetes.Models.Product", "Product") @@ -1117,55 +1251,77 @@ namespace PyroFetes.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("PyroFetes.Models.Contact", b => - { - b.HasOne("PyroFetes.Models.Communication", "Communication") - .WithMany() - .HasForeignKey("CommunicationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Communication"); - }); - - modelBuilder.Entity("PyroFetes.Models.Customer", b => + modelBuilder.Entity("PyroFetes.Models.Communication", b => { b.HasOne("PyroFetes.Models.Contact", "Contact") - .WithMany() + .WithMany("Communications") .HasForeignKey("ContactId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("Contact"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("ContactServiceProviders") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("ContactServiceProviders") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("Contracts") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("Contracts") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ServiceProvider"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { b.HasOne("PyroFetes.Models.CustomerType", "CustomerType") .WithMany("Customers") .HasForeignKey("CustomerTypeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("Contact"); - b.Navigation("CustomerType"); }); - modelBuilder.Entity("PyroFetes.Models.CustomerContact", b => - { - b.HasOne("PyroFetes.Models.Contact", "Contact") - .WithMany("CustomerContacts") - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("PyroFetes.Models.Customer", "Customer") - .WithMany("CustomerContacts") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Customer"); - }); - modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => { b.HasOne("PyroFetes.Models.Deliverer", "Deliverer") @@ -1177,10 +1333,21 @@ namespace PyroFetes.Migrations b.Navigation("Deliverer"); }); + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ExperienceLevels") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + modelBuilder.Entity("PyroFetes.Models.Material", b => { b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") - .WithMany("Materials") + .WithMany() .HasForeignKey("WarehouseId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1188,6 +1355,25 @@ namespace PyroFetes.Migrations b.Navigation("Warehouse"); }); + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("MaterialWarehouses") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("MaterialWarehouses") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Warehouse"); + }); + modelBuilder.Entity("PyroFetes.Models.Movement", b => { b.HasOne("PyroFetes.Models.Warehouse", "DestinationWarehouse") @@ -1195,12 +1381,6 @@ namespace PyroFetes.Migrations .HasForeignKey("DestinationWarehouseId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany("Movements") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - b.HasOne("PyroFetes.Models.Warehouse", "SourceWarehouse") .WithMany("MovementsSource") .HasForeignKey("SourceWarehouseId") @@ -1208,21 +1388,19 @@ namespace PyroFetes.Migrations b.Navigation("DestinationWarehouse"); - b.Navigation("Product"); - b.Navigation("SourceWarehouse"); }); modelBuilder.Entity("PyroFetes.Models.Price", b => { b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("Prices") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Supplier", "Supplier") - .WithMany() + .WithMany("Prices") .HasForeignKey("SupplierId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1240,6 +1418,12 @@ namespace PyroFetes.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("PyroFetes.Models.Movement", "Movement") + .WithMany("Products") + .HasForeignKey("MovementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("PyroFetes.Models.ProductCategory", "ProductCategory") .WithMany("Products") .HasForeignKey("ProductCategoryId") @@ -1248,19 +1432,21 @@ namespace PyroFetes.Migrations b.Navigation("Classification"); + b.Navigation("Movement"); + b.Navigation("ProductCategory"); }); modelBuilder.Entity("PyroFetes.Models.ProductColor", b => { b.HasOne("PyroFetes.Models.Color", "Color") - .WithMany() + .WithMany("ProductColors") .HasForeignKey("ColorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("ProductColors") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1273,13 +1459,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => { b.HasOne("PyroFetes.Models.DeliveryNote", "DeliveryNote") - .WithMany() + .WithMany("ProductDeliveries") .HasForeignKey("DeliveryNoteId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("ProductDeliveries") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1292,13 +1478,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => { b.HasOne("PyroFetes.Models.Effect", "Effect") - .WithMany() + .WithMany("ProductEffects") .HasForeignKey("EffectId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("ProductEffects") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1308,13 +1494,23 @@ namespace PyroFetes.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("PyroFetes.Models.Provider", b => + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => { - b.HasOne("PyroFetes.Models.ProviderType", "ProviderType") - .WithMany() - .HasForeignKey("ProviderTypeId"); + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductTimecodes") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.Navigation("ProviderType"); + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ProductTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Show"); }); modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => @@ -1325,7 +1521,7 @@ namespace PyroFetes.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("PyroFetes.Models.Provider", "Provider") + b.HasOne("PyroFetes.Models.ServiceProvider", "Provider") .WithMany() .HasForeignKey("ProviderId") .OnDelete(DeleteBehavior.Cascade) @@ -1339,13 +1535,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => { b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("PurchaseProducts") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.PurchaseOrder", "PurchaseOrder") - .WithMany() + .WithMany("PurchaseProducts") .HasForeignKey("PurchaseOrderId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1355,16 +1551,27 @@ namespace PyroFetes.Migrations b.Navigation("PurchaseOrder"); }); + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Quotations") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => { b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("QuotationProducts") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Quotation", "Quotation") - .WithMany() + .WithMany("QuotationProducts") .HasForeignKey("QuotationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1374,27 +1581,106 @@ namespace PyroFetes.Migrations b.Navigation("Quotation"); }); + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.HasOne("PyroFetes.Models.ProviderType", "ProviderType") + .WithMany("ServiceProviders") + .HasForeignKey("ProviderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderType"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.HasOne("PyroFetes.Models.City", "City") + .WithMany("Shows") + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("ShowMaterials") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowMaterials") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowStaffs") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ShowStaffs") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowTrucks") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Truck", "Truck") + .WithMany("ShowTrucks") + .HasForeignKey("TruckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Truck"); + }); + modelBuilder.Entity("PyroFetes.Models.Sound", b => { - b.HasOne("PyroFetes.Models.SoundCategory", "Category") + b.HasOne("PyroFetes.Models.SoundCategory", "SoundCategory") .WithMany("Sounds") .HasForeignKey("SoundCategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("Category"); + b.Navigation("SoundCategory"); }); modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => { b.HasOne("PyroFetes.Models.Show", "Show") - .WithMany("SoundCues") + .WithMany("SoundTimecodes") .HasForeignKey("ShowId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Sound", "Sound") - .WithMany("ShowPlacements") + .WithMany("SoundTimecodes") .HasForeignKey("SoundId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1407,13 +1693,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => { b.HasOne("PyroFetes.Models.Availability", "Availability") - .WithMany() + .WithMany("StaffAvailabilities") .HasForeignKey("AvailabilityId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Staff", "Staff") - .WithMany() + .WithMany("StaffAvailabilities") .HasForeignKey("StaffId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1426,13 +1712,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.StaffContact", b => { b.HasOne("PyroFetes.Models.Contact", "Contact") - .WithMany() + .WithMany("StaffContacts") .HasForeignKey("ContactId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Staff", "Staff") - .WithMany() + .WithMany("StaffContacts") .HasForeignKey("StaffId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1445,13 +1731,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => { b.HasOne("PyroFetes.Models.HistoryOfApproval", "HistoryOfApproval") - .WithMany() + .WithMany("StaffHistoryOfApprovals") .HasForeignKey("HistoryOfApprovalId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Staff", "Staff") - .WithMany() + .WithMany("StaffHistoryOfApprovals") .HasForeignKey("StaffId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1461,27 +1747,16 @@ namespace PyroFetes.Migrations b.Navigation("Staff"); }); - modelBuilder.Entity("PyroFetes.Models.Truck", b => - { - b.HasOne("PyroFetes.Models.Show", "Show") - .WithMany("Trucks") - .HasForeignKey("ShowId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Show"); - }); - modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => { b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("WarehouseProducts") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") - .WithMany() + .WithMany("WarehouseProducts") .HasForeignKey("WarehouseId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1491,19 +1766,14 @@ namespace PyroFetes.Migrations b.Navigation("Warehouse"); }); - modelBuilder.Entity("ShowStaff", b => + modelBuilder.Entity("PyroFetes.Models.Availability", b => { - b.HasOne("PyroFetes.Models.Show", null) - .WithMany() - .HasForeignKey("ShowsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + b.Navigation("StaffAvailabilities"); + }); - b.HasOne("PyroFetes.Models.Staff", null) - .WithMany() - .HasForeignKey("StaffId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Navigation("Shows"); }); modelBuilder.Entity("PyroFetes.Models.Classification", b => @@ -1511,14 +1781,25 @@ namespace PyroFetes.Migrations b.Navigation("Products"); }); + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Navigation("ProductColors"); + }); + modelBuilder.Entity("PyroFetes.Models.Contact", b => { - b.Navigation("CustomerContacts"); + b.Navigation("Communications"); + + b.Navigation("ContactServiceProviders"); + + b.Navigation("StaffContacts"); }); modelBuilder.Entity("PyroFetes.Models.Customer", b => { - b.Navigation("CustomerContacts"); + b.Navigation("Contacts"); + + b.Navigation("Quotations"); }); modelBuilder.Entity("PyroFetes.Models.CustomerType", b => @@ -1531,11 +1812,52 @@ namespace PyroFetes.Migrations b.Navigation("DeliveryNotes"); }); + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Navigation("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Navigation("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("ShowMaterials"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Navigation("Products"); + }); + modelBuilder.Entity("PyroFetes.Models.Product", b => { b.Navigation("Brands"); - b.Navigation("Movements"); + b.Navigation("Prices"); + + b.Navigation("ProductColors"); + + b.Navigation("ProductDeliveries"); + + b.Navigation("ProductEffects"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("PurchaseProducts"); + + b.Navigation("QuotationProducts"); + + b.Navigation("WarehouseProducts"); }); modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => @@ -1543,16 +1865,46 @@ namespace PyroFetes.Migrations b.Navigation("Products"); }); + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Navigation("ServiceProviders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Navigation("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Navigation("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Navigation("ContactServiceProviders"); + + b.Navigation("Contracts"); + }); + modelBuilder.Entity("PyroFetes.Models.Show", b => { - b.Navigation("SoundCues"); + b.Navigation("Contracts"); - b.Navigation("Trucks"); + b.Navigation("ProductTimecodes"); + + b.Navigation("ShowMaterials"); + + b.Navigation("ShowStaffs"); + + b.Navigation("ShowTrucks"); + + b.Navigation("SoundTimecodes"); }); modelBuilder.Entity("PyroFetes.Models.Sound", b => { - b.Navigation("ShowPlacements"); + b.Navigation("SoundTimecodes"); }); modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => @@ -1560,13 +1912,38 @@ namespace PyroFetes.Migrations b.Navigation("Sounds"); }); + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Navigation("ExperienceLevels"); + + b.Navigation("ShowStaffs"); + + b.Navigation("StaffAvailabilities"); + + b.Navigation("StaffContacts"); + + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Navigation("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Navigation("ShowTrucks"); + }); + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => { - b.Navigation("Materials"); + b.Navigation("MaterialWarehouses"); b.Navigation("MovementsDestination"); b.Navigation("MovementsSource"); + + b.Navigation("WarehouseProducts"); }); #pragma warning restore 612, 618 } diff --git a/PyroFetes/Migrations/20251007094021_InitialDatabase.cs b/PyroFetes/Migrations/20251008103414_InitialDatabase.cs similarity index 79% rename from PyroFetes/Migrations/20251007094021_InitialDatabase.cs rename to PyroFetes/Migrations/20251008103414_InitialDatabase.cs index 0d226b1..5c5dbc7 100644 --- a/PyroFetes/Migrations/20251007094021_InitialDatabase.cs +++ b/PyroFetes/Migrations/20251008103414_InitialDatabase.cs @@ -17,7 +17,7 @@ namespace PyroFetes.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - AvailabilityDate = table.Column(type: "nvarchar(max)", nullable: false), + AvailabilityDate = table.Column(type: "date", nullable: false), DeliveryDate = table.Column(type: "date", nullable: false), ExpirationDate = table.Column(type: "date", nullable: false), RenewallDate = table.Column(type: "date", nullable: false) @@ -27,13 +27,27 @@ namespace PyroFetes.Migrations table.PrimaryKey("PK_Availabilities", x => x.Id); }); + migrationBuilder.CreateTable( + name: "City", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_City", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Classifications", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Label = table.Column(type: "nvarchar(max)", nullable: false) + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { @@ -46,35 +60,20 @@ namespace PyroFetes.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Label = table.Column(type: "nvarchar(max)", nullable: false) + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { table.PrimaryKey("PK_Colors", x => x.Id); }); - migrationBuilder.CreateTable( - name: "Communications", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Calling = table.Column(type: "nvarchar(max)", nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - Meeting = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Communications", x => x.Id); - }); - migrationBuilder.CreateTable( name: "CustomerTypes", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Price = table.Column(type: "decimal(18,2)", nullable: false) + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { @@ -87,7 +86,7 @@ namespace PyroFetes.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Transporter = table.Column(type: "nvarchar(max)", nullable: false) + Transporter = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { @@ -100,34 +99,21 @@ namespace PyroFetes.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Label = table.Column(type: "nvarchar(max)", nullable: false) + Label = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) }, constraints: table => { table.PrimaryKey("PK_Effects", x => x.Id); }); - migrationBuilder.CreateTable( - name: "ExperienceLevels", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Label = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ExperienceLevels", x => x.Id); - }); - migrationBuilder.CreateTable( name: "HistoryOfApprovals", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - ExpirationDate = table.Column(type: "date", nullable: false), - DeliveryDate = table.Column(type: "date", nullable: false) + DeliveryDate = table.Column(type: "date", nullable: false), + ExpirationDate = table.Column(type: "date", nullable: false) }, constraints: table => { @@ -140,7 +126,7 @@ namespace PyroFetes.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Label = table.Column(type: "nvarchar(max)", nullable: false) + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { @@ -153,7 +139,7 @@ namespace PyroFetes.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Label = table.Column(type: "nvarchar(max)", nullable: false) + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { @@ -166,27 +152,13 @@ namespace PyroFetes.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - PurchaseConditions = table.Column(type: "nvarchar(max)", nullable: false) + PurchaseConditions = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false) }, constraints: table => { table.PrimaryKey("PK_PurchaseOrders", x => x.Id); }); - migrationBuilder.CreateTable( - name: "Quotations", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Message = table.Column(type: "nvarchar(max)", nullable: false), - ConditionsSale = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Quotations", x => x.Id); - }); - migrationBuilder.CreateTable( name: "Settings", columns: table => new @@ -201,30 +173,13 @@ namespace PyroFetes.Migrations table.PrimaryKey("PK_Settings", x => x.Id); }); - migrationBuilder.CreateTable( - name: "Shows", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(max)", nullable: false), - Place = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), - Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - PyrotechnicImplementationPlan = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), - Date = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Shows", x => x.Id); - }); - migrationBuilder.CreateTable( name: "SoundCategories", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false) + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { @@ -241,7 +196,7 @@ namespace PyroFetes.Migrations LastName = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), Profession = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), Email = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), - F4T2NumberApproval = table.Column(type: "nvarchar(max)", nullable: false), + F4T2NumberApproval = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), F4T2ExpirationDate = table.Column(type: "date", nullable: false) }, constraints: table => @@ -256,11 +211,11 @@ namespace PyroFetes.Migrations Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - Phone = table.Column(type: "nvarchar(max)", nullable: false), - Address = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Phone = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), ZipCode = table.Column(type: "int", nullable: false), - City = table.Column(type: "nvarchar(max)", nullable: false), + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), DeliveryDelay = table.Column(type: "int", nullable: false) }, constraints: table => @@ -268,6 +223,22 @@ namespace PyroFetes.Migrations table.PrimaryKey("PK_Suppliers", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Trucks", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Type = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + MaxExplosiveCapacity = table.Column(type: "float", nullable: false), + Sizes = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), + Status = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Trucks", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Users", columns: table => new @@ -275,10 +246,10 @@ namespace PyroFetes.Migrations Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Password = table.Column(type: "nvarchar(max)", nullable: false), - Salt = table.Column(type: "nvarchar(max)", nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - Fonction = table.Column(type: "nvarchar(max)", nullable: false) + Password = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Salt = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Fonction = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { @@ -295,9 +266,9 @@ namespace PyroFetes.Migrations MaxWeight = table.Column(type: "int", nullable: false), Current = table.Column(type: "int", nullable: false), MinWeight = table.Column(type: "int", nullable: false), - Address = table.Column(type: "nvarchar(max)", nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), ZipCode = table.Column(type: "int", nullable: false), - City = table.Column(type: "nvarchar(max)", nullable: false) + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) }, constraints: table => { @@ -305,28 +276,45 @@ namespace PyroFetes.Migrations }); migrationBuilder.CreateTable( - name: "Contacts", + name: "Shows", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - LastName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - FirstName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - PhoneNumber = table.Column(type: "nvarchar(max)", nullable: false), - Address = table.Column(type: "nvarchar(max)", nullable: false), - ZipCode = table.Column(type: "nvarchar(max)", nullable: false), - City = table.Column(type: "nvarchar(max)", nullable: false), - Role = table.Column(type: "nvarchar(max)", nullable: false), - CommunicationId = table.Column(type: "int", nullable: false) + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Place = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + Date = table.Column(type: "date", nullable: true), + PyrotechnicImplementationPlan = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), + CityId = table.Column(type: "int", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_Contacts", x => x.Id); + table.PrimaryKey("PK_Shows", x => x.Id); table.ForeignKey( - name: "FK_Contacts_Communications_CommunicationId", - column: x => x.CommunicationId, - principalTable: "Communications", + name: "FK_Shows_City_CityId", + column: x => x.CityId, + principalTable: "City", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Customers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Note = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + CustomerTypeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Customers", x => x.Id); + table.ForeignKey( + name: "FK_Customers_CustomerTypes_CustomerTypeId", + column: x => x.CustomerTypeId, + principalTable: "CustomerTypes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -337,7 +325,7 @@ namespace PyroFetes.Migrations { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - TrackingNumber = table.Column(type: "nvarchar(max)", nullable: false), + TrackingNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), DelivererId = table.Column(type: "int", nullable: false), EstimateDeliveryDate = table.Column(type: "date", nullable: false), ExpeditionDate = table.Column(type: "date", nullable: false), @@ -354,43 +342,6 @@ namespace PyroFetes.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "Products", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - References = table.Column(type: "int", nullable: false), - Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Duration = table.Column(type: "decimal(18,2)", nullable: false), - Caliber = table.Column(type: "decimal(18,2)", nullable: false), - ApprovalNumber = table.Column(type: "int", nullable: false), - Weight = table.Column(type: "decimal(18,2)", nullable: false), - Nec = table.Column(type: "decimal(18,2)", nullable: false), - SellingPrice = table.Column(type: "decimal(18,2)", nullable: false), - Image = table.Column(type: "nvarchar(max)", nullable: false), - Link = table.Column(type: "nvarchar(max)", nullable: false), - MinimalQuantity = table.Column(type: "int", nullable: false), - ClassificationId = table.Column(type: "int", nullable: false), - ProductCategoryId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Products", x => x.Id); - table.ForeignKey( - name: "FK_Products_Classifications_ClassificationId", - column: x => x.ClassificationId, - principalTable: "Classifications", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Products_ProductCategories_ProductCategoryId", - column: x => x.ProductCategoryId, - principalTable: "ProductCategories", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateTable( name: "Providers", columns: table => new @@ -398,8 +349,7 @@ namespace PyroFetes.Migrations Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Price = table.Column(type: "decimal(18,2)", nullable: false), - ProviderId = table.Column(type: "int", nullable: false), - ProviderTypeId = table.Column(type: "int", nullable: true) + ProviderTypeId = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -408,28 +358,6 @@ namespace PyroFetes.Migrations name: "FK_Providers_ProviderTypes_ProviderTypeId", column: x => x.ProviderTypeId, principalTable: "ProviderTypes", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "Trucks", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Type = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - MaxExplosiveCapacity = table.Column(type: "float", nullable: true), - Sizes = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), - Status = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), - ShowId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Trucks", x => x.Id); - table.ForeignKey( - name: "FK_Trucks_Shows_ShowId", - column: x => x.ShowId, - principalTable: "Shows", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -461,23 +389,19 @@ namespace PyroFetes.Migrations }); migrationBuilder.CreateTable( - name: "ShowStaff", + name: "ExperienceLevels", columns: table => new { - ShowsId = table.Column(type: "int", nullable: false), + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), StaffId = table.Column(type: "int", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_ShowStaff", x => new { x.ShowsId, x.StaffId }); + table.PrimaryKey("PK_ExperienceLevels", x => x.Id); table.ForeignKey( - name: "FK_ShowStaff_Shows_ShowsId", - column: x => x.ShowsId, - principalTable: "Shows", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ShowStaff_Staffs_StaffId", + name: "FK_ExperienceLevels_Staffs_StaffId", column: x => x.StaffId, principalTable: "Staffs", principalColumn: "Id", @@ -554,28 +478,340 @@ namespace PyroFetes.Migrations }); migrationBuilder.CreateTable( - name: "Customers", + name: "Movements", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Note = table.Column(type: "nvarchar(max)", nullable: false), - CustomerTypeId = table.Column(type: "int", nullable: false), + Date = table.Column(type: "datetime2", nullable: false), + Start = table.Column(type: "datetime2", nullable: false), + Arrival = table.Column(type: "datetime2", nullable: false), + Quantity = table.Column(type: "int", nullable: false), + SourceWarehouseId = table.Column(type: "int", nullable: true), + DestinationWarehouseId = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Movements", x => x.Id); + table.ForeignKey( + name: "FK_Movements_Warehouses_DestinationWarehouseId", + column: x => x.DestinationWarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Movements_Warehouses_SourceWarehouseId", + column: x => x.SourceWarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ShowStaff", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + ShowId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowStaff", x => new { x.StaffId, x.ShowId }); + table.ForeignKey( + name: "FK_ShowStaff_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowStaff_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ShowTruck", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + TruckId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowTruck", x => new { x.ShowId, x.TruckId }); + table.ForeignKey( + name: "FK_ShowTruck_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowTruck_Trucks_TruckId", + column: x => x.TruckId, + principalTable: "Trucks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Contacts", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + FirstName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + PhoneNumber = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false), + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Role = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + CustomerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Contacts", x => x.Id); + table.ForeignKey( + name: "FK_Contacts_Customers_CustomerId", + column: x => x.CustomerId, + principalTable: "Customers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Quotations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Message = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ConditionsSale = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), + CustomerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Quotations", x => x.Id); + table.ForeignKey( + name: "FK_Quotations_Customers_CustomerId", + column: x => x.CustomerId, + principalTable: "Customers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Contract", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + ServiceProviderId = table.Column(type: "int", nullable: false), + TermsAndConditions = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Contract", x => new { x.ShowId, x.ServiceProviderId }); + table.ForeignKey( + name: "FK_Contract_Providers_ServiceProviderId", + column: x => x.ServiceProviderId, + principalTable: "Providers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contract_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SoundTimecodes", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + SoundId = table.Column(type: "int", nullable: false), + Start = table.Column(type: "decimal(18,2)", nullable: false), + End = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SoundTimecodes", x => new { x.ShowId, x.SoundId }); + table.ForeignKey( + name: "FK_SoundTimecodes_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SoundTimecodes_Sounds_SoundId", + column: x => x.SoundId, + principalTable: "Sounds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "MaterialWarehouse", + columns: table => new + { + MaterialId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MaterialWarehouse", x => new { x.MaterialId, x.WarehouseId }); + table.ForeignKey( + name: "FK_MaterialWarehouse_Materials_MaterialId", + column: x => x.MaterialId, + principalTable: "Materials", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_MaterialWarehouse_Warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ShowMaterial", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + MaterialId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowMaterial", x => new { x.ShowId, x.MaterialId }); + table.ForeignKey( + name: "FK_ShowMaterial_Materials_MaterialId", + column: x => x.MaterialId, + principalTable: "Materials", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowMaterial_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Products", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + References = table.Column(type: "int", nullable: false), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Duration = table.Column(type: "decimal(18,2)", nullable: false), + Caliber = table.Column(type: "decimal(18,2)", nullable: false), + ApprovalNumber = table.Column(type: "int", nullable: false), + Weight = table.Column(type: "decimal(18,2)", nullable: false), + Nec = table.Column(type: "decimal(18,2)", nullable: false), + SellingPrice = table.Column(type: "decimal(18,2)", nullable: false), + Image = table.Column(type: "nvarchar(max)", nullable: false), + Link = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + MinimalQuantity = table.Column(type: "int", nullable: false), + ClassificationId = table.Column(type: "int", nullable: false), + ProductCategoryId = table.Column(type: "int", nullable: false), + MovementId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Products", x => x.Id); + table.ForeignKey( + name: "FK_Products_Classifications_ClassificationId", + column: x => x.ClassificationId, + principalTable: "Classifications", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Products_Movements_MovementId", + column: x => x.MovementId, + principalTable: "Movements", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Products_ProductCategories_ProductCategoryId", + column: x => x.ProductCategoryId, + principalTable: "ProductCategories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Communications", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Calling = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Meeting = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), ContactId = table.Column(type: "int", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_Customers", x => x.Id); + table.PrimaryKey("PK_Communications", x => x.Id); table.ForeignKey( - name: "FK_Customers_Contacts_ContactId", + name: "FK_Communications_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ContactServiceProvider", + columns: table => new + { + ContactId = table.Column(type: "int", nullable: false), + ServiceProviderId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ContactServiceProvider", x => new { x.ContactId, x.ServiceProviderId }); + table.ForeignKey( + name: "FK_ContactServiceProvider_Contacts_ContactId", column: x => x.ContactId, principalTable: "Contacts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_Customers_CustomerTypes_CustomerTypeId", - column: x => x.CustomerTypeId, - principalTable: "CustomerTypes", + name: "FK_ContactServiceProvider_Providers_ServiceProviderId", + column: x => x.ServiceProviderId, + principalTable: "Providers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProviderContacts", + columns: table => new + { + ProviderId = table.Column(type: "int", nullable: false), + ContactId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProviderContacts", x => new { x.ContactId, x.ProviderId }); + table.ForeignKey( + name: "FK_ProviderContacts_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProviderContacts_Providers_ProviderId", + column: x => x.ProviderId, + principalTable: "Providers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); @@ -624,43 +860,6 @@ namespace PyroFetes.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "Movements", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Date = table.Column(type: "datetime2", nullable: false), - Start = table.Column(type: "datetime2", nullable: false), - Arrival = table.Column(type: "datetime2", nullable: false), - Quantity = table.Column(type: "int", nullable: false), - ProductId = table.Column(type: "int", nullable: false), - SourceWarehouseId = table.Column(type: "int", nullable: true), - DestinationWarehouseId = table.Column(type: "int", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Movements", x => x.Id); - table.ForeignKey( - name: "FK_Movements_Products_ProductId", - column: x => x.ProductId, - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Movements_Warehouses_DestinationWarehouseId", - column: x => x.DestinationWarehouseId, - principalTable: "Warehouses", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Movements_Warehouses_SourceWarehouseId", - column: x => x.SourceWarehouseId, - principalTable: "Warehouses", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - migrationBuilder.CreateTable( name: "Prices", columns: table => new @@ -759,6 +958,32 @@ namespace PyroFetes.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "ProductTimecode", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + ShowId = table.Column(type: "int", nullable: false), + Start = table.Column(type: "decimal(18,2)", nullable: false), + End = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductTimecode", x => new { x.ProductId, x.ShowId }); + table.ForeignKey( + name: "FK_ProductTimecode_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductTimecode_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "PurchaseProducts", columns: table => new @@ -813,14 +1038,13 @@ namespace PyroFetes.Migrations name: "WarehouseProducts", columns: table => new { - Quantity = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), ProductId = table.Column(type: "int", nullable: false), - WarehouseId = table.Column(type: "int", nullable: false) + WarehouseId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_WarehouseProducts", x => x.Quantity); + table.PrimaryKey("PK_WarehouseProducts", x => new { x.ProductId, x.WarehouseId }); table.ForeignKey( name: "FK_WarehouseProducts_Products_ProductId", column: x => x.ProductId, @@ -835,99 +1059,30 @@ namespace PyroFetes.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "ProviderContacts", - columns: table => new - { - ProviderId = table.Column(type: "int", nullable: false), - ContactId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ProviderContacts", x => new { x.ContactId, x.ProviderId }); - table.ForeignKey( - name: "FK_ProviderContacts_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ProviderContacts_Providers_ProviderId", - column: x => x.ProviderId, - principalTable: "Providers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "SoundTimecodes", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ShowId = table.Column(type: "int", nullable: false), - SoundId = table.Column(type: "int", nullable: false), - Start = table.Column(type: "int", nullable: false), - End = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_SoundTimecodes", x => x.Id); - table.ForeignKey( - name: "FK_SoundTimecodes_Shows_ShowId", - column: x => x.ShowId, - principalTable: "Shows", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_SoundTimecodes_Sounds_SoundId", - column: x => x.SoundId, - principalTable: "Sounds", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "CustomerContacts", - columns: table => new - { - CustomerId = table.Column(type: "int", nullable: false), - ContactId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CustomerContacts", x => new { x.ContactId, x.CustomerId }); - table.ForeignKey( - name: "FK_CustomerContacts_Contacts_ContactId", - column: x => x.ContactId, - principalTable: "Contacts", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_CustomerContacts_Customers_CustomerId", - column: x => x.CustomerId, - principalTable: "Customers", - principalColumn: "Id"); - }); - migrationBuilder.CreateIndex( name: "IX_Brands_ProductId", table: "Brands", column: "ProductId"); migrationBuilder.CreateIndex( - name: "IX_Contacts_CommunicationId", - table: "Contacts", - column: "CommunicationId"); + name: "IX_Communications_ContactId", + table: "Communications", + column: "ContactId"); migrationBuilder.CreateIndex( - name: "IX_CustomerContacts_CustomerId", - table: "CustomerContacts", + name: "IX_Contacts_CustomerId", + table: "Contacts", column: "CustomerId"); migrationBuilder.CreateIndex( - name: "IX_Customers_ContactId", - table: "Customers", - column: "ContactId"); + name: "IX_ContactServiceProvider_ServiceProviderId", + table: "ContactServiceProvider", + column: "ServiceProviderId"); + + migrationBuilder.CreateIndex( + name: "IX_Contract_ServiceProviderId", + table: "Contract", + column: "ServiceProviderId"); migrationBuilder.CreateIndex( name: "IX_Customers_CustomerTypeId", @@ -939,21 +1094,26 @@ namespace PyroFetes.Migrations table: "DeliveryNotes", column: "DelivererId"); + migrationBuilder.CreateIndex( + name: "IX_ExperienceLevels_StaffId", + table: "ExperienceLevels", + column: "StaffId"); + migrationBuilder.CreateIndex( name: "IX_Materials_WarehouseId", table: "Materials", column: "WarehouseId"); + migrationBuilder.CreateIndex( + name: "IX_MaterialWarehouse_WarehouseId", + table: "MaterialWarehouse", + column: "WarehouseId"); + migrationBuilder.CreateIndex( name: "IX_Movements_DestinationWarehouseId", table: "Movements", column: "DestinationWarehouseId"); - migrationBuilder.CreateIndex( - name: "IX_Movements_ProductId", - table: "Movements", - column: "ProductId"); - migrationBuilder.CreateIndex( name: "IX_Movements_SourceWarehouseId", table: "Movements", @@ -984,11 +1144,21 @@ namespace PyroFetes.Migrations table: "Products", column: "ClassificationId"); + migrationBuilder.CreateIndex( + name: "IX_Products_MovementId", + table: "Products", + column: "MovementId"); + migrationBuilder.CreateIndex( name: "IX_Products_ProductCategoryId", table: "Products", column: "ProductCategoryId"); + migrationBuilder.CreateIndex( + name: "IX_ProductTimecode_ShowId", + table: "ProductTimecode", + column: "ShowId"); + migrationBuilder.CreateIndex( name: "IX_ProviderContacts_ProviderId", table: "ProviderContacts", @@ -1010,20 +1180,35 @@ namespace PyroFetes.Migrations column: "QuotationId"); migrationBuilder.CreateIndex( - name: "IX_ShowStaff_StaffId", + name: "IX_Quotations_CustomerId", + table: "Quotations", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowMaterial_MaterialId", + table: "ShowMaterial", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_Shows_CityId", + table: "Shows", + column: "CityId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowStaff_ShowId", table: "ShowStaff", - column: "StaffId"); + column: "ShowId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowTruck_TruckId", + table: "ShowTruck", + column: "TruckId"); migrationBuilder.CreateIndex( name: "IX_Sounds_SoundCategoryId", table: "Sounds", column: "SoundCategoryId"); - migrationBuilder.CreateIndex( - name: "IX_SoundTimecodes_ShowId", - table: "SoundTimecodes", - column: "ShowId"); - migrationBuilder.CreateIndex( name: "IX_SoundTimecodes_SoundId", table: "SoundTimecodes", @@ -1044,16 +1229,6 @@ namespace PyroFetes.Migrations table: "StaffHistoryOfApprovals", column: "StaffId"); - migrationBuilder.CreateIndex( - name: "IX_Trucks_ShowId", - table: "Trucks", - column: "ShowId"); - - migrationBuilder.CreateIndex( - name: "IX_WarehouseProducts_ProductId", - table: "WarehouseProducts", - column: "ProductId"); - migrationBuilder.CreateIndex( name: "IX_WarehouseProducts_WarehouseId", table: "WarehouseProducts", @@ -1067,16 +1242,19 @@ namespace PyroFetes.Migrations name: "Brands"); migrationBuilder.DropTable( - name: "CustomerContacts"); + name: "Communications"); + + migrationBuilder.DropTable( + name: "ContactServiceProvider"); + + migrationBuilder.DropTable( + name: "Contract"); migrationBuilder.DropTable( name: "ExperienceLevels"); migrationBuilder.DropTable( - name: "Materials"); - - migrationBuilder.DropTable( - name: "Movements"); + name: "MaterialWarehouse"); migrationBuilder.DropTable( name: "Prices"); @@ -1090,6 +1268,9 @@ namespace PyroFetes.Migrations migrationBuilder.DropTable( name: "ProductEffects"); + migrationBuilder.DropTable( + name: "ProductTimecode"); + migrationBuilder.DropTable( name: "ProviderContacts"); @@ -1102,9 +1283,15 @@ namespace PyroFetes.Migrations migrationBuilder.DropTable( name: "Settings"); + migrationBuilder.DropTable( + name: "ShowMaterial"); + migrationBuilder.DropTable( name: "ShowStaff"); + migrationBuilder.DropTable( + name: "ShowTruck"); + migrationBuilder.DropTable( name: "SoundTimecodes"); @@ -1117,18 +1304,12 @@ namespace PyroFetes.Migrations migrationBuilder.DropTable( name: "StaffHistoryOfApprovals"); - migrationBuilder.DropTable( - name: "Trucks"); - migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "WarehouseProducts"); - migrationBuilder.DropTable( - name: "Customers"); - migrationBuilder.DropTable( name: "Suppliers"); @@ -1150,50 +1331,62 @@ namespace PyroFetes.Migrations migrationBuilder.DropTable( name: "Quotations"); + migrationBuilder.DropTable( + name: "Materials"); + + migrationBuilder.DropTable( + name: "Trucks"); + + migrationBuilder.DropTable( + name: "Shows"); + migrationBuilder.DropTable( name: "Sounds"); migrationBuilder.DropTable( name: "Availabilities"); + migrationBuilder.DropTable( + name: "Contacts"); + migrationBuilder.DropTable( name: "HistoryOfApprovals"); migrationBuilder.DropTable( name: "Staffs"); - migrationBuilder.DropTable( - name: "Shows"); - migrationBuilder.DropTable( name: "Products"); - migrationBuilder.DropTable( - name: "Warehouses"); - - migrationBuilder.DropTable( - name: "Contacts"); - - migrationBuilder.DropTable( - name: "CustomerTypes"); - migrationBuilder.DropTable( name: "Deliverers"); migrationBuilder.DropTable( name: "ProviderTypes"); + migrationBuilder.DropTable( + name: "City"); + migrationBuilder.DropTable( name: "SoundCategories"); + migrationBuilder.DropTable( + name: "Customers"); + migrationBuilder.DropTable( name: "Classifications"); + migrationBuilder.DropTable( + name: "Movements"); + migrationBuilder.DropTable( name: "ProductCategories"); migrationBuilder.DropTable( - name: "Communications"); + name: "CustomerTypes"); + + migrationBuilder.DropTable( + name: "Warehouses"); } } } diff --git a/PyroFetes/Migrations/PyroFetesDbContextModelSnapshot.cs b/PyroFetes/Migrations/PyroFetesDbContextModelSnapshot.cs index 3f047d1..1f414fb 100644 --- a/PyroFetes/Migrations/PyroFetesDbContextModelSnapshot.cs +++ b/PyroFetes/Migrations/PyroFetesDbContextModelSnapshot.cs @@ -30,9 +30,8 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("AvailabilityDate") - .IsRequired() - .HasColumnType("nvarchar(max)"); + b.Property("AvailabilityDate") + .HasColumnType("date"); b.Property("DeliveryDate") .HasColumnType("date"); @@ -71,6 +70,27 @@ namespace PyroFetes.Migrations b.ToTable("Brands"); }); + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("City"); + }); + modelBuilder.Entity("PyroFetes.Models.Classification", b => { b.Property("Id") @@ -81,7 +101,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -98,7 +119,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -115,18 +137,26 @@ namespace PyroFetes.Migrations b.Property("Calling") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ContactId") + .HasColumnType("int"); b.Property("Email") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Meeting") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); b.HasKey("Id"); + b.HasIndex("ContactId"); + b.ToTable("Communications"); }); @@ -140,18 +170,21 @@ namespace PyroFetes.Migrations b.Property("Address") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("City") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("CommunicationId") + b.Property("CustomerId") .HasColumnType("int"); b.Property("Email") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("FirstName") .IsRequired() @@ -165,23 +198,58 @@ namespace PyroFetes.Migrations b.Property("PhoneNumber") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); b.Property("Role") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); - b.Property("ZipCode") - .IsRequired() - .HasColumnType("nvarchar(max)"); + b.Property("ZipCode") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("CommunicationId"); + b.HasIndex("CustomerId"); b.ToTable("Contacts"); }); + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("ContactServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.Property("TermsAndConditions") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ShowId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("Contract"); + }); + modelBuilder.Entity("PyroFetes.Models.Customer", b => { b.Property("Id") @@ -190,40 +258,21 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("ContactId") - .HasColumnType("int"); - b.Property("CustomerTypeId") .HasColumnType("int"); b.Property("Note") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); - b.HasIndex("ContactId"); - b.HasIndex("CustomerTypeId"); b.ToTable("Customers"); }); - modelBuilder.Entity("PyroFetes.Models.CustomerContact", b => - { - b.Property("ContactId") - .HasColumnType("int"); - - b.Property("CustomerId") - .HasColumnType("int"); - - b.HasKey("ContactId", "CustomerId"); - - b.HasIndex("CustomerId"); - - b.ToTable("CustomerContacts"); - }); - modelBuilder.Entity("PyroFetes.Models.CustomerType", b => { b.Property("Id") @@ -232,8 +281,10 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("Price") - .HasColumnType("decimal(18,2)"); + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -250,7 +301,8 @@ namespace PyroFetes.Migrations b.Property("Transporter") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -279,7 +331,8 @@ namespace PyroFetes.Migrations b.Property("TrackingNumber") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -298,7 +351,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); @@ -315,10 +369,16 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("StaffId") + .HasColumnType("int"); b.HasKey("Id"); + b.HasIndex("StaffId"); + b.ToTable("ExperienceLevels"); }); @@ -367,6 +427,21 @@ namespace PyroFetes.Migrations b.ToTable("Materials"); }); + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.Property("MaterialId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("MaterialId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("MaterialWarehouse"); + }); + modelBuilder.Entity("PyroFetes.Models.Movement", b => { b.Property("Id") @@ -384,9 +459,6 @@ namespace PyroFetes.Migrations b.Property("DestinationWarehouseId") .HasColumnType("int"); - b.Property("ProductId") - .HasColumnType("int"); - b.Property("Quantity") .HasColumnType("int"); @@ -400,8 +472,6 @@ namespace PyroFetes.Migrations b.HasIndex("DestinationWarehouseId"); - b.HasIndex("ProductId"); - b.HasIndex("SourceWarehouseId"); b.ToTable("Movements"); @@ -451,11 +521,15 @@ namespace PyroFetes.Migrations b.Property("Link") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.Property("MinimalQuantity") .HasColumnType("int"); + b.Property("MovementId") + .HasColumnType("int"); + b.Property("Name") .IsRequired() .HasMaxLength(100) @@ -480,6 +554,8 @@ namespace PyroFetes.Migrations b.HasIndex("ClassificationId"); + b.HasIndex("MovementId"); + b.HasIndex("ProductCategoryId"); b.ToTable("Products"); @@ -495,7 +571,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -550,28 +627,25 @@ namespace PyroFetes.Migrations b.ToTable("ProductEffects"); }); - modelBuilder.Entity("PyroFetes.Models.Provider", b => + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => { - b.Property("Id") - .ValueGeneratedOnAdd() + b.Property("ProductId") .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + b.Property("ShowId") + .HasColumnType("int"); - b.Property("Price") + b.Property("End") .HasColumnType("decimal(18,2)"); - b.Property("ProviderId") - .HasColumnType("int"); + b.Property("Start") + .HasColumnType("decimal(18,2)"); - b.Property("ProviderTypeId") - .HasColumnType("int"); + b.HasKey("ProductId", "ShowId"); - b.HasKey("Id"); + b.HasIndex("ShowId"); - b.HasIndex("ProviderTypeId"); - - b.ToTable("Providers"); + b.ToTable("ProductTimecode"); }); modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => @@ -599,7 +673,8 @@ namespace PyroFetes.Migrations b.Property("Label") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -616,7 +691,8 @@ namespace PyroFetes.Migrations b.Property("PurchaseConditions") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); b.HasKey("Id"); @@ -651,14 +727,21 @@ namespace PyroFetes.Migrations b.Property("ConditionsSale") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("CustomerId") + .HasColumnType("int"); b.Property("Message") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); b.HasKey("Id"); + b.HasIndex("CustomerId"); + b.ToTable("Quotations"); }); @@ -680,6 +763,27 @@ namespace PyroFetes.Migrations b.ToTable("QuotationProducts"); }); + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("ProviderTypeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProviderTypeId"); + + b.ToTable("Providers"); + }); + modelBuilder.Entity("PyroFetes.Models.Setting", b => { b.Property("Id") @@ -709,8 +813,11 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - b.Property("Date") - .HasColumnType("datetime2"); + b.Property("CityId") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("date"); b.Property("Description") .HasMaxLength(500) @@ -718,7 +825,8 @@ namespace PyroFetes.Migrations b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Place") .IsRequired() @@ -732,9 +840,56 @@ namespace PyroFetes.Migrations b.HasKey("Id"); + b.HasIndex("CityId"); + b.ToTable("Shows"); }); + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("MaterialId") + .HasColumnType("int"); + + b.HasKey("ShowId", "MaterialId"); + + b.HasIndex("MaterialId"); + + b.ToTable("ShowMaterial"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.Property("StaffId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.HasKey("StaffId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ShowStaff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("TruckId") + .HasColumnType("int"); + + b.HasKey("ShowId", "TruckId"); + + b.HasIndex("TruckId"); + + b.ToTable("ShowTruck"); + }); + modelBuilder.Entity("PyroFetes.Models.Sound", b => { b.Property("Id") @@ -795,8 +950,8 @@ namespace PyroFetes.Migrations b.Property("Name") .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -805,27 +960,19 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("End") - .HasColumnType("int"); - b.Property("ShowId") .HasColumnType("int"); b.Property("SoundId") .HasColumnType("int"); - b.Property("Start") - .HasColumnType("int"); + b.Property("End") + .HasColumnType("decimal(18,2)"); - b.HasKey("Id"); + b.Property("Start") + .HasColumnType("decimal(18,2)"); - b.HasIndex("ShowId"); + b.HasKey("ShowId", "SoundId"); b.HasIndex("SoundId"); @@ -850,7 +997,8 @@ namespace PyroFetes.Migrations b.Property("F4T2NumberApproval") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("FirstName") .IsRequired() @@ -927,18 +1075,21 @@ namespace PyroFetes.Migrations b.Property("Address") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("City") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("DeliveryDelay") .HasColumnType("int"); b.Property("Email") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Name") .IsRequired() @@ -947,7 +1098,8 @@ namespace PyroFetes.Migrations b.Property("Phone") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); b.Property("ZipCode") .HasColumnType("int"); @@ -966,11 +1118,9 @@ namespace PyroFetes.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("MaxExplosiveCapacity") + .IsRequired() .HasColumnType("float"); - b.Property("ShowId") - .HasColumnType("int"); - b.Property("Sizes") .IsRequired() .HasMaxLength(80) @@ -988,8 +1138,6 @@ namespace PyroFetes.Migrations b.HasKey("Id"); - b.HasIndex("ShowId"); - b.ToTable("Trucks"); }); @@ -1003,11 +1151,13 @@ namespace PyroFetes.Migrations b.Property("Email") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Fonction") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Name") .IsRequired() @@ -1016,11 +1166,13 @@ namespace PyroFetes.Migrations b.Property("Password") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); b.Property("Salt") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.HasKey("Id"); @@ -1037,11 +1189,13 @@ namespace PyroFetes.Migrations b.Property("Address") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("City") .IsRequired() - .HasColumnType("nvarchar(max)"); + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); b.Property("Current") .HasColumnType("int"); @@ -1067,42 +1221,22 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => { - b.Property("Quantity") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Quantity")); - b.Property("ProductId") .HasColumnType("int"); b.Property("WarehouseId") .HasColumnType("int"); - b.HasKey("Quantity"); + b.Property("Quantity") + .HasColumnType("int"); - b.HasIndex("ProductId"); + b.HasKey("ProductId", "WarehouseId"); b.HasIndex("WarehouseId"); b.ToTable("WarehouseProducts"); }); - modelBuilder.Entity("ShowStaff", b => - { - b.Property("ShowsId") - .HasColumnType("int"); - - b.Property("StaffId") - .HasColumnType("int"); - - b.HasKey("ShowsId", "StaffId"); - - b.HasIndex("StaffId"); - - b.ToTable("ShowStaff"); - }); - modelBuilder.Entity("PyroFetes.Models.Brand", b => { b.HasOne("PyroFetes.Models.Product", "Product") @@ -1114,55 +1248,77 @@ namespace PyroFetes.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("PyroFetes.Models.Contact", b => - { - b.HasOne("PyroFetes.Models.Communication", "Communication") - .WithMany() - .HasForeignKey("CommunicationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Communication"); - }); - - modelBuilder.Entity("PyroFetes.Models.Customer", b => + modelBuilder.Entity("PyroFetes.Models.Communication", b => { b.HasOne("PyroFetes.Models.Contact", "Contact") - .WithMany() + .WithMany("Communications") .HasForeignKey("ContactId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("Contact"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("ContactServiceProviders") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("ContactServiceProviders") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("Contracts") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("Contracts") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ServiceProvider"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { b.HasOne("PyroFetes.Models.CustomerType", "CustomerType") .WithMany("Customers") .HasForeignKey("CustomerTypeId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("Contact"); - b.Navigation("CustomerType"); }); - modelBuilder.Entity("PyroFetes.Models.CustomerContact", b => - { - b.HasOne("PyroFetes.Models.Contact", "Contact") - .WithMany("CustomerContacts") - .HasForeignKey("ContactId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("PyroFetes.Models.Customer", "Customer") - .WithMany("CustomerContacts") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Contact"); - - b.Navigation("Customer"); - }); - modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => { b.HasOne("PyroFetes.Models.Deliverer", "Deliverer") @@ -1174,10 +1330,21 @@ namespace PyroFetes.Migrations b.Navigation("Deliverer"); }); + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ExperienceLevels") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + modelBuilder.Entity("PyroFetes.Models.Material", b => { b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") - .WithMany("Materials") + .WithMany() .HasForeignKey("WarehouseId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1185,6 +1352,25 @@ namespace PyroFetes.Migrations b.Navigation("Warehouse"); }); + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("MaterialWarehouses") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("MaterialWarehouses") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Warehouse"); + }); + modelBuilder.Entity("PyroFetes.Models.Movement", b => { b.HasOne("PyroFetes.Models.Warehouse", "DestinationWarehouse") @@ -1192,12 +1378,6 @@ namespace PyroFetes.Migrations .HasForeignKey("DestinationWarehouseId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany("Movements") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - b.HasOne("PyroFetes.Models.Warehouse", "SourceWarehouse") .WithMany("MovementsSource") .HasForeignKey("SourceWarehouseId") @@ -1205,21 +1385,19 @@ namespace PyroFetes.Migrations b.Navigation("DestinationWarehouse"); - b.Navigation("Product"); - b.Navigation("SourceWarehouse"); }); modelBuilder.Entity("PyroFetes.Models.Price", b => { b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("Prices") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Supplier", "Supplier") - .WithMany() + .WithMany("Prices") .HasForeignKey("SupplierId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1237,6 +1415,12 @@ namespace PyroFetes.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("PyroFetes.Models.Movement", "Movement") + .WithMany("Products") + .HasForeignKey("MovementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("PyroFetes.Models.ProductCategory", "ProductCategory") .WithMany("Products") .HasForeignKey("ProductCategoryId") @@ -1245,19 +1429,21 @@ namespace PyroFetes.Migrations b.Navigation("Classification"); + b.Navigation("Movement"); + b.Navigation("ProductCategory"); }); modelBuilder.Entity("PyroFetes.Models.ProductColor", b => { b.HasOne("PyroFetes.Models.Color", "Color") - .WithMany() + .WithMany("ProductColors") .HasForeignKey("ColorId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("ProductColors") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1270,13 +1456,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => { b.HasOne("PyroFetes.Models.DeliveryNote", "DeliveryNote") - .WithMany() + .WithMany("ProductDeliveries") .HasForeignKey("DeliveryNoteId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("ProductDeliveries") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1289,13 +1475,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => { b.HasOne("PyroFetes.Models.Effect", "Effect") - .WithMany() + .WithMany("ProductEffects") .HasForeignKey("EffectId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("ProductEffects") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1305,13 +1491,23 @@ namespace PyroFetes.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("PyroFetes.Models.Provider", b => + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => { - b.HasOne("PyroFetes.Models.ProviderType", "ProviderType") - .WithMany() - .HasForeignKey("ProviderTypeId"); + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductTimecodes") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.Navigation("ProviderType"); + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ProductTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Show"); }); modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => @@ -1322,7 +1518,7 @@ namespace PyroFetes.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("PyroFetes.Models.Provider", "Provider") + b.HasOne("PyroFetes.Models.ServiceProvider", "Provider") .WithMany() .HasForeignKey("ProviderId") .OnDelete(DeleteBehavior.Cascade) @@ -1336,13 +1532,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => { b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("PurchaseProducts") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.PurchaseOrder", "PurchaseOrder") - .WithMany() + .WithMany("PurchaseProducts") .HasForeignKey("PurchaseOrderId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1352,16 +1548,27 @@ namespace PyroFetes.Migrations b.Navigation("PurchaseOrder"); }); + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Quotations") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => { b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("QuotationProducts") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Quotation", "Quotation") - .WithMany() + .WithMany("QuotationProducts") .HasForeignKey("QuotationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1371,27 +1578,106 @@ namespace PyroFetes.Migrations b.Navigation("Quotation"); }); + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.HasOne("PyroFetes.Models.ProviderType", "ProviderType") + .WithMany("ServiceProviders") + .HasForeignKey("ProviderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderType"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.HasOne("PyroFetes.Models.City", "City") + .WithMany("Shows") + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("ShowMaterials") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowMaterials") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowStaffs") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ShowStaffs") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowTrucks") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Truck", "Truck") + .WithMany("ShowTrucks") + .HasForeignKey("TruckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Truck"); + }); + modelBuilder.Entity("PyroFetes.Models.Sound", b => { - b.HasOne("PyroFetes.Models.SoundCategory", "Category") + b.HasOne("PyroFetes.Models.SoundCategory", "SoundCategory") .WithMany("Sounds") .HasForeignKey("SoundCategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("Category"); + b.Navigation("SoundCategory"); }); modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => { b.HasOne("PyroFetes.Models.Show", "Show") - .WithMany("SoundCues") + .WithMany("SoundTimecodes") .HasForeignKey("ShowId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Sound", "Sound") - .WithMany("ShowPlacements") + .WithMany("SoundTimecodes") .HasForeignKey("SoundId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1404,13 +1690,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => { b.HasOne("PyroFetes.Models.Availability", "Availability") - .WithMany() + .WithMany("StaffAvailabilities") .HasForeignKey("AvailabilityId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Staff", "Staff") - .WithMany() + .WithMany("StaffAvailabilities") .HasForeignKey("StaffId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1423,13 +1709,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.StaffContact", b => { b.HasOne("PyroFetes.Models.Contact", "Contact") - .WithMany() + .WithMany("StaffContacts") .HasForeignKey("ContactId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Staff", "Staff") - .WithMany() + .WithMany("StaffContacts") .HasForeignKey("StaffId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1442,13 +1728,13 @@ namespace PyroFetes.Migrations modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => { b.HasOne("PyroFetes.Models.HistoryOfApproval", "HistoryOfApproval") - .WithMany() + .WithMany("StaffHistoryOfApprovals") .HasForeignKey("HistoryOfApprovalId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Staff", "Staff") - .WithMany() + .WithMany("StaffHistoryOfApprovals") .HasForeignKey("StaffId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1458,27 +1744,16 @@ namespace PyroFetes.Migrations b.Navigation("Staff"); }); - modelBuilder.Entity("PyroFetes.Models.Truck", b => - { - b.HasOne("PyroFetes.Models.Show", "Show") - .WithMany("Trucks") - .HasForeignKey("ShowId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Show"); - }); - modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => { b.HasOne("PyroFetes.Models.Product", "Product") - .WithMany() + .WithMany("WarehouseProducts") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") - .WithMany() + .WithMany("WarehouseProducts") .HasForeignKey("WarehouseId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1488,19 +1763,14 @@ namespace PyroFetes.Migrations b.Navigation("Warehouse"); }); - modelBuilder.Entity("ShowStaff", b => + modelBuilder.Entity("PyroFetes.Models.Availability", b => { - b.HasOne("PyroFetes.Models.Show", null) - .WithMany() - .HasForeignKey("ShowsId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + b.Navigation("StaffAvailabilities"); + }); - b.HasOne("PyroFetes.Models.Staff", null) - .WithMany() - .HasForeignKey("StaffId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Navigation("Shows"); }); modelBuilder.Entity("PyroFetes.Models.Classification", b => @@ -1508,14 +1778,25 @@ namespace PyroFetes.Migrations b.Navigation("Products"); }); + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Navigation("ProductColors"); + }); + modelBuilder.Entity("PyroFetes.Models.Contact", b => { - b.Navigation("CustomerContacts"); + b.Navigation("Communications"); + + b.Navigation("ContactServiceProviders"); + + b.Navigation("StaffContacts"); }); modelBuilder.Entity("PyroFetes.Models.Customer", b => { - b.Navigation("CustomerContacts"); + b.Navigation("Contacts"); + + b.Navigation("Quotations"); }); modelBuilder.Entity("PyroFetes.Models.CustomerType", b => @@ -1528,11 +1809,52 @@ namespace PyroFetes.Migrations b.Navigation("DeliveryNotes"); }); + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Navigation("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Navigation("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("ShowMaterials"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Navigation("Products"); + }); + modelBuilder.Entity("PyroFetes.Models.Product", b => { b.Navigation("Brands"); - b.Navigation("Movements"); + b.Navigation("Prices"); + + b.Navigation("ProductColors"); + + b.Navigation("ProductDeliveries"); + + b.Navigation("ProductEffects"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("PurchaseProducts"); + + b.Navigation("QuotationProducts"); + + b.Navigation("WarehouseProducts"); }); modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => @@ -1540,16 +1862,46 @@ namespace PyroFetes.Migrations b.Navigation("Products"); }); + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Navigation("ServiceProviders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Navigation("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Navigation("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Navigation("ContactServiceProviders"); + + b.Navigation("Contracts"); + }); + modelBuilder.Entity("PyroFetes.Models.Show", b => { - b.Navigation("SoundCues"); + b.Navigation("Contracts"); - b.Navigation("Trucks"); + b.Navigation("ProductTimecodes"); + + b.Navigation("ShowMaterials"); + + b.Navigation("ShowStaffs"); + + b.Navigation("ShowTrucks"); + + b.Navigation("SoundTimecodes"); }); modelBuilder.Entity("PyroFetes.Models.Sound", b => { - b.Navigation("ShowPlacements"); + b.Navigation("SoundTimecodes"); }); modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => @@ -1557,13 +1909,38 @@ namespace PyroFetes.Migrations b.Navigation("Sounds"); }); + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Navigation("ExperienceLevels"); + + b.Navigation("ShowStaffs"); + + b.Navigation("StaffAvailabilities"); + + b.Navigation("StaffContacts"); + + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Navigation("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Navigation("ShowTrucks"); + }); + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => { - b.Navigation("Materials"); + b.Navigation("MaterialWarehouses"); b.Navigation("MovementsDestination"); b.Navigation("MovementsSource"); + + b.Navigation("WarehouseProducts"); }); #pragma warning restore 612, 618 } diff --git a/PyroFetes/Models/MaterialWarehouse.cs b/PyroFetes/Models/MaterialWarehouse.cs index 6f797b9..4f49ba9 100644 --- a/PyroFetes/Models/MaterialWarehouse.cs +++ b/PyroFetes/Models/MaterialWarehouse.cs @@ -1,7 +1,9 @@ using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; namespace PyroFetes.Models; +[PrimaryKey(nameof(MaterialId), nameof(WarehouseId))] public class MaterialWarehouse { [Required] public int MaterialId { get; set; } diff --git a/PyroFetes/PyroFetesDbContext.cs b/PyroFetes/PyroFetesDbContext.cs index 9c25dd8..b5ce8c7 100644 --- a/PyroFetes/PyroFetesDbContext.cs +++ b/PyroFetes/PyroFetesDbContext.cs @@ -77,5 +77,17 @@ public class PyroFetesDbContext : DbContext .WithMany(w => w.MovementsDestination) .HasForeignKey(m => m.DestinationWarehouseId) .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity() + .HasOne(mw => mw.Material) + .WithMany(m => m.MaterialWarehouses) + .HasForeignKey(mw => mw.MaterialId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity() + .HasOne(mw => mw.Warehouse) + .WithMany(w => w.MaterialWarehouses) + .HasForeignKey(mw => mw.WarehouseId) + .OnDelete(DeleteBehavior.Restrict); } } \ No newline at end of file