diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240319190111_InitialCreate.Designer.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240417054900_Init.Designer.cs similarity index 67% rename from PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240319190111_InitialCreate.Designer.cs rename to PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240417054900_Init.Designer.cs index 947ad7a..7aca924 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240319190111_InitialCreate.Designer.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240417054900_Init.Designer.cs @@ -12,8 +12,8 @@ using PrecastConcretePlantDatabaseImplement; namespace PrecastConcretePlantDatabaseImplement.Migrations { [DbContext(typeof(PrecastConcretePlantDatabase))] - [Migration("20240319190111_InitialCreate")] - partial class InitialCreate + [Migration("20240417054900_Init")] + partial class Init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -124,6 +124,59 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations b.ToTable("ReinforcedComponents"); }); + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateOpening") + .HasColumnType("datetime2"); + + b.Property("ReinforcedsMax") + .HasColumnType("int"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("ReinforcedId") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ReinforcedId"); + + b.HasIndex("ShopId"); + + b.ToTable("ShopReinforceds"); + }); + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Order", b => { b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced") @@ -154,6 +207,25 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations b.Navigation("Reinforced"); }); + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b => + { + b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced") + .WithMany("ShopReinforceds") + .HasForeignKey("ReinforcedId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Shop", "Shop") + .WithMany("Reinforceds") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Reinforced"); + + b.Navigation("Shop"); + }); + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Component", b => { b.Navigation("ReinforcedComponents"); @@ -164,6 +236,13 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations b.Navigation("Components"); b.Navigation("Orders"); + + b.Navigation("ShopReinforceds"); + }); + + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Shop", b => + { + b.Navigation("Reinforceds"); }); #pragma warning restore 612, 618 } diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240319190111_InitialCreate.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240417054900_Init.cs similarity index 65% rename from PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240319190111_InitialCreate.cs rename to PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240417054900_Init.cs index b2eb22d..5a2c443 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240319190111_InitialCreate.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/20240417054900_Init.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace PrecastConcretePlantDatabaseImplement.Migrations { /// - public partial class InitialCreate : Migration + public partial class Init : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -39,6 +39,22 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations table.PrimaryKey("PK_Reinforceds", x => x.Id); }); + migrationBuilder.CreateTable( + name: "Shops", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ShopName = table.Column(type: "nvarchar(max)", nullable: false), + Address = table.Column(type: "nvarchar(max)", nullable: false), + DateOpening = table.Column(type: "datetime2", nullable: false), + ReinforcedsMax = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Shops", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Orders", columns: table => new @@ -90,6 +106,33 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "ShopReinforceds", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ShopId = table.Column(type: "int", nullable: false), + ReinforcedId = table.Column(type: "int", nullable: false), + Count = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShopReinforceds", x => x.Id); + table.ForeignKey( + name: "FK_ShopReinforceds_Reinforceds_ReinforcedId", + column: x => x.ReinforcedId, + principalTable: "Reinforceds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShopReinforceds_Shops_ShopId", + column: x => x.ShopId, + principalTable: "Shops", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateIndex( name: "IX_Orders_ReinforcedId", table: "Orders", @@ -104,6 +147,16 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations name: "IX_ReinforcedComponents_ReinforcedId", table: "ReinforcedComponents", column: "ReinforcedId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopReinforceds_ReinforcedId", + table: "ShopReinforceds", + column: "ReinforcedId"); + + migrationBuilder.CreateIndex( + name: "IX_ShopReinforceds_ShopId", + table: "ShopReinforceds", + column: "ShopId"); } /// @@ -115,11 +168,17 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations migrationBuilder.DropTable( name: "ReinforcedComponents"); + migrationBuilder.DropTable( + name: "ShopReinforceds"); + migrationBuilder.DropTable( name: "Components"); migrationBuilder.DropTable( name: "Reinforceds"); + + migrationBuilder.DropTable( + name: "Shops"); } } } diff --git a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/PrecastConcretePlantDatabaseModelSnapshot.cs b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/PrecastConcretePlantDatabaseModelSnapshot.cs index bf6d470..ef9408e 100644 --- a/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/PrecastConcretePlantDatabaseModelSnapshot.cs +++ b/PrecastConcretePlant/PrecastConcretePlantDatabaseImplement/Migrations/PrecastConcretePlantDatabaseModelSnapshot.cs @@ -121,6 +121,59 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations b.ToTable("ReinforcedComponents"); }); + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Shop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateOpening") + .HasColumnType("datetime2"); + + b.Property("ReinforcedsMax") + .HasColumnType("int"); + + b.Property("ShopName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Shops"); + }); + + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("ReinforcedId") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ReinforcedId"); + + b.HasIndex("ShopId"); + + b.ToTable("ShopReinforceds"); + }); + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Order", b => { b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced") @@ -151,6 +204,25 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations b.Navigation("Reinforced"); }); + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.ShopReinforced", b => + { + b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Reinforced", "Reinforced") + .WithMany("ShopReinforceds") + .HasForeignKey("ReinforcedId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PrecastConcretePlantDatabaseImplement.Models.Shop", "Shop") + .WithMany("Reinforceds") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Reinforced"); + + b.Navigation("Shop"); + }); + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Component", b => { b.Navigation("ReinforcedComponents"); @@ -161,6 +233,13 @@ namespace PrecastConcretePlantDatabaseImplement.Migrations b.Navigation("Components"); b.Navigation("Orders"); + + b.Navigation("ShopReinforceds"); + }); + + modelBuilder.Entity("PrecastConcretePlantDatabaseImplement.Models.Shop", b => + { + b.Navigation("Reinforceds"); }); #pragma warning restore 612, 618 }