This commit is contained in:
Daniel 2023-04-08 23:17:52 +04:00
parent 57b8e568ea
commit 297b3711e3
8 changed files with 14 additions and 2418 deletions

View File

@ -6,4 +6,18 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FactoryContracts\FactoryContracts.csproj" />
<ProjectReference Include="..\FactoryDataModels\FactoryDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -1,447 +0,0 @@
// <auto-generated />
using FactoryDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace FactoryDatabaseImplement.Migrations
{
[DbContext(typeof(FactoryDatabase))]
[Migration("20230402190902_initmigration")]
partial class initmigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("FactoryDatabaseImplement.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.Property<int>("EnginierId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Engenier", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Fio")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Engeniers");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BusyId")
.HasColumnType("int");
b.Property<string>("LatheName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("MasterId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BusyId");
b.HasIndex("MasterId");
b.ToTable("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheBusy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Percent")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("LatheBusies");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheReinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("LatheId")
.HasColumnType("int");
b.Property<int>("ReinforcedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LatheId");
b.HasIndex("ReinforcedId");
b.ToTable("LatheReinforcedes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Master", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Fio")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Masters");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("PlanName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Plans");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanComponents", 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>("PlanId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PlanId");
b.ToTable("PlanComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanLathe", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("LatheId")
.HasColumnType("int");
b.Property<int>("PlanId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LatheId");
b.HasIndex("PlanId");
b.ToTable("PlanLathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("EngenierId")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<string>("ReinforcedName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("EngenierId");
b.ToTable("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.ReinforcedComponent", 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>("ReinforcedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("ReinforcedId");
b.ToTable("ReinforcedComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Stage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("PlanId")
.HasColumnType("int");
b.Property<int>("ReinforsedId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Stages");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.LatheBusy", null)
.WithMany("Lathes")
.HasForeignKey("BusyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Master", null)
.WithMany("LatheId")
.HasForeignKey("MasterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheReinforced", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Lathe", "Lathe")
.WithMany("Reinforceds")
.HasForeignKey("LatheId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Reinforced", "Reinforced")
.WithMany()
.HasForeignKey("ReinforcedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lathe");
b.Navigation("Reinforced");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanComponents", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", "Component")
.WithMany()
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Plan", "Plan")
.WithMany("Components")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Plan");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanLathe", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Lathe", "Lathe")
.WithMany()
.HasForeignKey("LatheId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Plan", "Plan")
.WithMany("Lathes")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lathe");
b.Navigation("Plan");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Engenier", null)
.WithMany("Reinforceds")
.HasForeignKey("EngenierId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.ReinforcedComponent", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", "Component")
.WithMany("ReinforcedComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Reinforced", "Reinforced")
.WithMany("Components")
.HasForeignKey("ReinforcedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Reinforced");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Component", b =>
{
b.Navigation("ReinforcedComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Engenier", b =>
{
b.Navigation("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.Navigation("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheBusy", b =>
{
b.Navigation("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Master", b =>
{
b.Navigation("LatheId");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.Navigation("Components");
b.Navigation("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.Navigation("Components");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,350 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FactoryDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class initmigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Components",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ComponentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Cost = table.Column<double>(type: "float", nullable: false),
EnginierId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Components", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Engeniers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Fio = 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_Engeniers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LatheBusies",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Percent = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LatheBusies", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Masters",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
Fio = table.Column<string>(type: "nvarchar(max)", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Masters", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Plans",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PlanName = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Plans", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Stages",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PlanId = table.Column<int>(type: "int", nullable: false),
ReinforsedId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Stages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Reinforceds",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ReinforcedName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Price = table.Column<double>(type: "float", nullable: false),
EngenierId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Reinforceds", x => x.Id);
table.ForeignKey(
name: "FK_Reinforceds_Engeniers_EngenierId",
column: x => x.EngenierId,
principalTable: "Engeniers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Lathes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
LatheName = table.Column<string>(type: "nvarchar(max)", nullable: false),
MasterId = table.Column<int>(type: "int", nullable: false),
BusyId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Lathes", x => x.Id);
table.ForeignKey(
name: "FK_Lathes_LatheBusies_BusyId",
column: x => x.BusyId,
principalTable: "LatheBusies",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Lathes_Masters_MasterId",
column: x => x.MasterId,
principalTable: "Masters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PlanComponents",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PlanId = table.Column<int>(type: "int", nullable: false),
ComponentId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PlanComponents", x => x.Id);
table.ForeignKey(
name: "FK_PlanComponents_Components_ComponentId",
column: x => x.ComponentId,
principalTable: "Components",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlanComponents_Plans_PlanId",
column: x => x.PlanId,
principalTable: "Plans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ReinforcedComponents",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ReinforcedId = table.Column<int>(type: "int", nullable: false),
ComponentId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ReinforcedComponents", x => x.Id);
table.ForeignKey(
name: "FK_ReinforcedComponents_Components_ComponentId",
column: x => x.ComponentId,
principalTable: "Components",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ReinforcedComponents_Reinforceds_ReinforcedId",
column: x => x.ReinforcedId,
principalTable: "Reinforceds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LatheReinforcedes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
LatheId = table.Column<int>(type: "int", nullable: false),
ReinforcedId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LatheReinforcedes", x => x.Id);
table.ForeignKey(
name: "FK_LatheReinforcedes_Lathes_LatheId",
column: x => x.LatheId,
principalTable: "Lathes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LatheReinforcedes_Reinforceds_ReinforcedId",
column: x => x.ReinforcedId,
principalTable: "Reinforceds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PlanLathes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PlanId = table.Column<int>(type: "int", nullable: false),
LatheId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PlanLathes", x => x.Id);
table.ForeignKey(
name: "FK_PlanLathes_Lathes_LatheId",
column: x => x.LatheId,
principalTable: "Lathes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PlanLathes_Plans_PlanId",
column: x => x.PlanId,
principalTable: "Plans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_LatheReinforcedes_LatheId",
table: "LatheReinforcedes",
column: "LatheId");
migrationBuilder.CreateIndex(
name: "IX_LatheReinforcedes_ReinforcedId",
table: "LatheReinforcedes",
column: "ReinforcedId");
migrationBuilder.CreateIndex(
name: "IX_Lathes_BusyId",
table: "Lathes",
column: "BusyId");
migrationBuilder.CreateIndex(
name: "IX_Lathes_MasterId",
table: "Lathes",
column: "MasterId");
migrationBuilder.CreateIndex(
name: "IX_PlanComponents_ComponentId",
table: "PlanComponents",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_PlanComponents_PlanId",
table: "PlanComponents",
column: "PlanId");
migrationBuilder.CreateIndex(
name: "IX_PlanLathes_LatheId",
table: "PlanLathes",
column: "LatheId");
migrationBuilder.CreateIndex(
name: "IX_PlanLathes_PlanId",
table: "PlanLathes",
column: "PlanId");
migrationBuilder.CreateIndex(
name: "IX_ReinforcedComponents_ComponentId",
table: "ReinforcedComponents",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_ReinforcedComponents_ReinforcedId",
table: "ReinforcedComponents",
column: "ReinforcedId");
migrationBuilder.CreateIndex(
name: "IX_Reinforceds_EngenierId",
table: "Reinforceds",
column: "EngenierId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LatheReinforcedes");
migrationBuilder.DropTable(
name: "PlanComponents");
migrationBuilder.DropTable(
name: "PlanLathes");
migrationBuilder.DropTable(
name: "ReinforcedComponents");
migrationBuilder.DropTable(
name: "Stages");
migrationBuilder.DropTable(
name: "Lathes");
migrationBuilder.DropTable(
name: "Plans");
migrationBuilder.DropTable(
name: "Components");
migrationBuilder.DropTable(
name: "Reinforceds");
migrationBuilder.DropTable(
name: "LatheBusies");
migrationBuilder.DropTable(
name: "Masters");
migrationBuilder.DropTable(
name: "Engeniers");
}
}
}

View File

@ -1,473 +0,0 @@
// <auto-generated />
using System;
using FactoryDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace FactoryDatabaseImplement.Migrations
{
[DbContext(typeof(FactoryDatabase))]
[Migration("20230402191341_initmigration1")]
partial class initmigration1
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("FactoryDatabaseImplement.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.Property<int>("EnginierId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Engenier", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Fio")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Engeniers");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BusyId")
.HasColumnType("int");
b.Property<string>("LatheName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("MasterId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BusyId");
b.HasIndex("MasterId");
b.ToTable("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheBusy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Percent")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("LatheBusies");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheReinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("LatheId")
.HasColumnType("int");
b.Property<int>("ReinforcedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LatheId");
b.HasIndex("ReinforcedId");
b.ToTable("LatheReinforcedes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Master", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Fio")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Masters");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("ComponentId")
.HasColumnType("int");
b.Property<int?>("PlanId")
.HasColumnType("int");
b.Property<string>("PlanName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PlanId");
b.ToTable("Plans");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanComponents", 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>("PlanId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PlanId");
b.ToTable("PlanComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanLathe", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("LatheId")
.HasColumnType("int");
b.Property<int>("PlanId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LatheId");
b.HasIndex("PlanId");
b.ToTable("PlanLathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("EngenierId")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<string>("ReinforcedName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("EngenierId");
b.ToTable("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.ReinforcedComponent", 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>("ReinforcedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("ReinforcedId");
b.ToTable("ReinforcedComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Stage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("PlanId")
.HasColumnType("int");
b.Property<int>("ReinforsedId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Stages");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.LatheBusy", null)
.WithMany("Lathes")
.HasForeignKey("BusyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Master", null)
.WithMany("LatheId")
.HasForeignKey("MasterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheReinforced", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Lathe", "Lathe")
.WithMany("Reinforceds")
.HasForeignKey("LatheId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Reinforced", "Reinforced")
.WithMany()
.HasForeignKey("ReinforcedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lathe");
b.Navigation("Reinforced");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", null)
.WithMany("Plans")
.HasForeignKey("ComponentId");
b.HasOne("FactoryDatabaseImplement.Models.Plan", null)
.WithMany("Plans")
.HasForeignKey("PlanId");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanComponents", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", "Component")
.WithMany()
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Plan", "Plan")
.WithMany("Components")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Plan");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanLathe", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Lathe", "Lathe")
.WithMany()
.HasForeignKey("LatheId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Plan", "Plan")
.WithMany("Lathes")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lathe");
b.Navigation("Plan");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Engenier", null)
.WithMany("Reinforceds")
.HasForeignKey("EngenierId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.ReinforcedComponent", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", "Component")
.WithMany("ReinforcedComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Reinforced", "Reinforced")
.WithMany("Components")
.HasForeignKey("ReinforcedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Reinforced");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Component", b =>
{
b.Navigation("Plans");
b.Navigation("ReinforcedComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Engenier", b =>
{
b.Navigation("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.Navigation("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheBusy", b =>
{
b.Navigation("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Master", b =>
{
b.Navigation("LatheId");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.Navigation("Components");
b.Navigation("Lathes");
b.Navigation("Plans");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.Navigation("Components");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,78 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FactoryDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class initmigration1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ComponentId",
table: "Plans",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PlanId",
table: "Plans",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Plans_ComponentId",
table: "Plans",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_Plans_PlanId",
table: "Plans",
column: "PlanId");
migrationBuilder.AddForeignKey(
name: "FK_Plans_Components_ComponentId",
table: "Plans",
column: "ComponentId",
principalTable: "Components",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Plans_Plans_PlanId",
table: "Plans",
column: "PlanId",
principalTable: "Plans",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Plans_Components_ComponentId",
table: "Plans");
migrationBuilder.DropForeignKey(
name: "FK_Plans_Plans_PlanId",
table: "Plans");
migrationBuilder.DropIndex(
name: "IX_Plans_ComponentId",
table: "Plans");
migrationBuilder.DropIndex(
name: "IX_Plans_PlanId",
table: "Plans");
migrationBuilder.DropColumn(
name: "ComponentId",
table: "Plans");
migrationBuilder.DropColumn(
name: "PlanId",
table: "Plans");
}
}
}

View File

@ -1,472 +0,0 @@
// <auto-generated />
using System;
using FactoryDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace FactoryDatabaseImplement.Migrations
{
[DbContext(typeof(FactoryDatabase))]
[Migration("20230402191647_initmigration2")]
partial class initmigration2
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("FactoryDatabaseImplement.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.Property<int>("EnginierId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Engenier", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Fio")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Engeniers");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BusyId")
.HasColumnType("int");
b.Property<string>("LatheName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("MasterId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BusyId");
b.HasIndex("MasterId");
b.ToTable("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheBusy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Percent")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("LatheBusies");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheReinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("LatheId")
.HasColumnType("int");
b.Property<int>("ReinforcedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LatheId");
b.HasIndex("ReinforcedId");
b.ToTable("LatheReinforcedes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Master", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Fio")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Masters");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("PlanName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Plans");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanComponents", 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>("PlanId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PlanId");
b.ToTable("PlanComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanLathe", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("LatheId")
.HasColumnType("int");
b.Property<int>("PlanId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LatheId");
b.HasIndex("PlanId");
b.ToTable("PlanLathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("EngenierId")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<string>("ReinforcedName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("EngenierId");
b.ToTable("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.ReinforcedComponent", 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>("ReinforcedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("ReinforcedId");
b.ToTable("ReinforcedComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Stage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("ComponentId")
.HasColumnType("int");
b.Property<int>("PlanId")
.HasColumnType("int");
b.Property<int>("ReinforsedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PlanId");
b.ToTable("Stages");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.LatheBusy", null)
.WithMany("Lathes")
.HasForeignKey("BusyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Master", null)
.WithMany("LatheId")
.HasForeignKey("MasterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheReinforced", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Lathe", "Lathe")
.WithMany("Reinforceds")
.HasForeignKey("LatheId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Reinforced", "Reinforced")
.WithMany()
.HasForeignKey("ReinforcedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lathe");
b.Navigation("Reinforced");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanComponents", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", "Component")
.WithMany()
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Plan", "Plan")
.WithMany("Components")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Plan");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanLathe", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Lathe", "Lathe")
.WithMany()
.HasForeignKey("LatheId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Plan", "Plan")
.WithMany("Lathes")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lathe");
b.Navigation("Plan");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Engenier", null)
.WithMany("Reinforceds")
.HasForeignKey("EngenierId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.ReinforcedComponent", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", "Component")
.WithMany("ReinforcedComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Reinforced", "Reinforced")
.WithMany("Components")
.HasForeignKey("ReinforcedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Reinforced");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Stage", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", null)
.WithMany("Stages")
.HasForeignKey("ComponentId");
b.HasOne("FactoryDatabaseImplement.Models.Plan", null)
.WithMany("Stages")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Component", b =>
{
b.Navigation("ReinforcedComponents");
b.Navigation("Stages");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Engenier", b =>
{
b.Navigation("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.Navigation("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheBusy", b =>
{
b.Navigation("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Master", b =>
{
b.Navigation("LatheId");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.Navigation("Components");
b.Navigation("Lathes");
b.Navigation("Stages");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.Navigation("Components");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,129 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FactoryDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class initmigration2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Plans_Components_ComponentId",
table: "Plans");
migrationBuilder.DropForeignKey(
name: "FK_Plans_Plans_PlanId",
table: "Plans");
migrationBuilder.DropIndex(
name: "IX_Plans_ComponentId",
table: "Plans");
migrationBuilder.DropIndex(
name: "IX_Plans_PlanId",
table: "Plans");
migrationBuilder.DropColumn(
name: "ComponentId",
table: "Plans");
migrationBuilder.DropColumn(
name: "PlanId",
table: "Plans");
migrationBuilder.AddColumn<int>(
name: "ComponentId",
table: "Stages",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Stages_ComponentId",
table: "Stages",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_Stages_PlanId",
table: "Stages",
column: "PlanId");
migrationBuilder.AddForeignKey(
name: "FK_Stages_Components_ComponentId",
table: "Stages",
column: "ComponentId",
principalTable: "Components",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Stages_Plans_PlanId",
table: "Stages",
column: "PlanId",
principalTable: "Plans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Stages_Components_ComponentId",
table: "Stages");
migrationBuilder.DropForeignKey(
name: "FK_Stages_Plans_PlanId",
table: "Stages");
migrationBuilder.DropIndex(
name: "IX_Stages_ComponentId",
table: "Stages");
migrationBuilder.DropIndex(
name: "IX_Stages_PlanId",
table: "Stages");
migrationBuilder.DropColumn(
name: "ComponentId",
table: "Stages");
migrationBuilder.AddColumn<int>(
name: "ComponentId",
table: "Plans",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PlanId",
table: "Plans",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Plans_ComponentId",
table: "Plans",
column: "ComponentId");
migrationBuilder.CreateIndex(
name: "IX_Plans_PlanId",
table: "Plans",
column: "PlanId");
migrationBuilder.AddForeignKey(
name: "FK_Plans_Components_ComponentId",
table: "Plans",
column: "ComponentId",
principalTable: "Components",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Plans_Plans_PlanId",
table: "Plans",
column: "PlanId",
principalTable: "Plans",
principalColumn: "Id");
}
}
}

View File

@ -1,469 +0,0 @@
// <auto-generated />
using System;
using FactoryDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace FactoryDatabaseImplement.Migrations
{
[DbContext(typeof(FactoryDatabase))]
partial class FactoryDatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("FactoryDatabaseImplement.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.Property<int>("EnginierId")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Engenier", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Fio")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Engeniers");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BusyId")
.HasColumnType("int");
b.Property<string>("LatheName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("MasterId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BusyId");
b.HasIndex("MasterId");
b.ToTable("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheBusy", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Percent")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("LatheBusies");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheReinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("LatheId")
.HasColumnType("int");
b.Property<int>("ReinforcedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LatheId");
b.HasIndex("ReinforcedId");
b.ToTable("LatheReinforcedes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Master", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Fio")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Masters");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("PlanName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Plans");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanComponents", 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>("PlanId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PlanId");
b.ToTable("PlanComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanLathe", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("LatheId")
.HasColumnType("int");
b.Property<int>("PlanId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LatheId");
b.HasIndex("PlanId");
b.ToTable("PlanLathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("EngenierId")
.HasColumnType("int");
b.Property<double>("Price")
.HasColumnType("float");
b.Property<string>("ReinforcedName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("EngenierId");
b.ToTable("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.ReinforcedComponent", 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>("ReinforcedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("ReinforcedId");
b.ToTable("ReinforcedComponents");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Stage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int?>("ComponentId")
.HasColumnType("int");
b.Property<int>("PlanId")
.HasColumnType("int");
b.Property<int>("ReinforsedId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PlanId");
b.ToTable("Stages");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.LatheBusy", null)
.WithMany("Lathes")
.HasForeignKey("BusyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Master", null)
.WithMany("LatheId")
.HasForeignKey("MasterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheReinforced", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Lathe", "Lathe")
.WithMany("Reinforceds")
.HasForeignKey("LatheId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Reinforced", "Reinforced")
.WithMany()
.HasForeignKey("ReinforcedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lathe");
b.Navigation("Reinforced");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanComponents", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", "Component")
.WithMany()
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Plan", "Plan")
.WithMany("Components")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Plan");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanLathe", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Lathe", "Lathe")
.WithMany()
.HasForeignKey("LatheId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Plan", "Plan")
.WithMany("Lathes")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Lathe");
b.Navigation("Plan");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Engenier", null)
.WithMany("Reinforceds")
.HasForeignKey("EngenierId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.ReinforcedComponent", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", "Component")
.WithMany("ReinforcedComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FactoryDatabaseImplement.Models.Reinforced", "Reinforced")
.WithMany("Components")
.HasForeignKey("ReinforcedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Reinforced");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Stage", b =>
{
b.HasOne("FactoryDatabaseImplement.Models.Component", null)
.WithMany("Stages")
.HasForeignKey("ComponentId");
b.HasOne("FactoryDatabaseImplement.Models.Plan", null)
.WithMany("Stages")
.HasForeignKey("PlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Component", b =>
{
b.Navigation("ReinforcedComponents");
b.Navigation("Stages");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Engenier", b =>
{
b.Navigation("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Lathe", b =>
{
b.Navigation("Reinforceds");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.LatheBusy", b =>
{
b.Navigation("Lathes");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Master", b =>
{
b.Navigation("LatheId");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Plan", b =>
{
b.Navigation("Components");
b.Navigation("Lathes");
b.Navigation("Stages");
});
modelBuilder.Entity("FactoryDatabaseImplement.Models.Reinforced", b =>
{
b.Navigation("Components");
});
#pragma warning restore 612, 618
}
}
}