PIbd-22_Chernyshev_G.Y._LabWork05_Hard #13
248
GarmentFactoryDatabaseImplement/Migrations/20240515060701_Lab3_Hard_AddedShops.Designer.cs
generated
Normal file
248
GarmentFactoryDatabaseImplement/Migrations/20240515060701_Lab3_Hard_AddedShops.Designer.cs
generated
Normal file
@ -0,0 +1,248 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GarmentFactoryDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GarmentFactoryDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(GarmentFactoryDatabase))]
|
||||
[Migration("20240515060701_Lab3_Hard_AddedShops")]
|
||||
partial class Lab3_Hard_AddedShops
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ComponentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Components");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DateComplete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("TextileId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("TextileId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ShopName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("TextileMaxCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shops");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.ShopTextile", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ShopId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TextileId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShopId");
|
||||
|
||||
b.HasIndex("TextileId");
|
||||
|
||||
b.ToTable("ShopTextiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("TextileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Textiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ComponentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TextileId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComponentId");
|
||||
|
||||
b.HasIndex("TextileId");
|
||||
|
||||
b.ToTable("TextileComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("TextileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Textile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.ShopTextile", b =>
|
||||
{
|
||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Shop", "Shop")
|
||||
.WithMany("Textiles")
|
||||
.HasForeignKey("ShopId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile")
|
||||
.WithMany()
|
||||
.HasForeignKey("TextileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Shop");
|
||||
|
||||
b.Navigation("Textile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b =>
|
||||
{
|
||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Component", "Component")
|
||||
.WithMany("TextileComponents")
|
||||
.HasForeignKey("ComponentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile")
|
||||
.WithMany("Components")
|
||||
.HasForeignKey("TextileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Component");
|
||||
|
||||
b.Navigation("Textile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("TextileComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Navigation("Textiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GarmentFactoryDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Lab3_Hard_AddedShops : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Shops",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
DateOpen = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
TextileMaxCount = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Shops", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShopTextiles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
TextileId = table.Column<int>(type: "int", nullable: false),
|
||||
ShopId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShopTextiles", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopTextiles_Shops_ShopId",
|
||||
column: x => x.ShopId,
|
||||
principalTable: "Shops",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ShopTextiles_Textiles_TextileId",
|
||||
column: x => x.TextileId,
|
||||
principalTable: "Textiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopTextiles_ShopId",
|
||||
table: "ShopTextiles",
|
||||
column: "ShopId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ShopTextiles_TextileId",
|
||||
table: "ShopTextiles",
|
||||
column: "TextileId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShopTextiles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Shops");
|
||||
}
|
||||
}
|
||||
}
|
@ -75,6 +75,59 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ShopName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("TextileMaxCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Shops");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.ShopTextile", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ShopId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TextileId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShopId");
|
||||
|
||||
b.HasIndex("TextileId");
|
||||
|
||||
b.ToTable("ShopTextiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -132,6 +185,25 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
||||
b.Navigation("Textile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.ShopTextile", b =>
|
||||
{
|
||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Shop", "Shop")
|
||||
.WithMany("Textiles")
|
||||
.HasForeignKey("ShopId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Textile", "Textile")
|
||||
.WithMany()
|
||||
.HasForeignKey("TextileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Shop");
|
||||
|
||||
b.Navigation("Textile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.TextileComponent", b =>
|
||||
{
|
||||
b.HasOne("GarmentFactoryDatabaseImplement.Models.Component", "Component")
|
||||
@ -156,6 +228,11 @@ namespace GarmentFactoryDatabaseImplement.Migrations
|
||||
b.Navigation("TextileComponents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Shop", b =>
|
||||
{
|
||||
b.Navigation("Textiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GarmentFactoryDatabaseImplement.Models.Textile", b =>
|
||||
{
|
||||
b.Navigation("Components");
|
||||
|
Loading…
Reference in New Issue
Block a user