забыл самое главное

This commit is contained in:
m1aksim1 2023-04-25 04:19:49 +04:00
parent 1a09e4f8ee
commit 3dd0029329
4 changed files with 121 additions and 1 deletions

View File

@ -12,7 +12,7 @@ using SoftwareInstallationDatabaseImplement;
namespace SoftWareInstallationDatabaseImplement.Migrations
{
[DbContext(typeof(SoftwareInstallationDatabase))]
[Migration("20230403200159_InitialCreate")]
[Migration("20230425001835_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -25,6 +25,31 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
@ -53,6 +78,9 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
@ -73,6 +101,8 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("PackageId");
b.ToTable("Orders");
@ -184,12 +214,20 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Order", b =>
{
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", "Package")
.WithMany("Orders")
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Package");
});
@ -238,6 +276,11 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
b.Navigation("Shop");
});
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Component", b =>
{
b.Navigation("PackageComponents");

View File

@ -11,6 +11,21 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Clients",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ClientFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clients", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Components",
columns: table => new
@ -46,6 +61,7 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PackageId = table.Column<int>(type: "int", nullable: false),
ClientId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false),
Sum = table.Column<double>(type: "float", nullable: false),
Status = table.Column<int>(type: "int", nullable: false),
@ -55,6 +71,12 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
constraints: table =>
{
table.PrimaryKey("PK_Orders", x => x.Id);
table.ForeignKey(
name: "FK_Orders_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Orders_Packages_PackageId",
column: x => x.PackageId,
@ -139,6 +161,11 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Orders_ClientId",
table: "Orders",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Orders_PackageId",
table: "Orders",
@ -182,6 +209,9 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "ShopPackages");
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "Components");

View File

@ -22,6 +22,31 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
@ -50,6 +75,9 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
@ -70,6 +98,8 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("PackageId");
b.ToTable("Orders");
@ -181,12 +211,20 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Order", b =>
{
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SoftwareInstallationDatabaseImplement.Models.Package", "Package")
.WithMany("Orders")
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Package");
});
@ -235,6 +273,11 @@ namespace SoftWareInstallationDatabaseImplement.Migrations
b.Navigation("Shop");
});
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SoftwareInstallationDatabaseImplement.Models.Component", b =>
{
b.Navigation("PackageComponents");

View File

@ -20,4 +20,8 @@
<ProjectReference Include="..\SoftwareInstallationDataModels\SoftwareInstallationDataModels.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>