fix entity relations
This commit is contained in:
parent
c6e5fb354f
commit
2e1e5efd98
10
Factory/FactoryDataModels/Properties/launchSettings.json
Normal file
10
Factory/FactoryDataModels/Properties/launchSettings.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"profiles": {
|
||||
"FactoryDataModels": {
|
||||
"commandName": "Project"
|
||||
},
|
||||
"Профиль 1": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,14 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.29" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.29">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.29">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.22" />
|
||||
</ItemGroup>
|
||||
|
||||
|
546
Factory/FactoryDatabaseImplement/Migrations/20240428141730_InitCreate.Designer.cs
generated
Normal file
546
Factory/FactoryDatabaseImplement/Migrations/20240428141730_InitCreate.Designer.cs
generated
Normal file
@ -0,0 +1,546 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FactoryDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FactoryDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(FactoryDatabase))]
|
||||
[Migration("20240428141730_InitCreate")]
|
||||
partial class InitCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.29")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ExecutionPhase", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExecutionPhaseName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ImplementerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("ExecutionPhases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Machine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("ExploitationStartDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("Lifetime")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MachineName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Machines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.MachinePlanProduction", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MachineId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PlanProductionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MachineId");
|
||||
|
||||
b.HasIndex("PlanProductionId");
|
||||
|
||||
b.ToTable("MachinePlanProductions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Deadline")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("ExecutionPhaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ProductionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("ExecutionPhaseId");
|
||||
|
||||
b.ToTable("PlanProductions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProductionWorkpiece", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PlanProductionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("WorkpieceId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlanProductionId");
|
||||
|
||||
b.HasIndex("WorkpieceId");
|
||||
|
||||
b.ToTable("PlanProductionWorkpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RequirementId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ProductMachine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MachineId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MachineId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("ProductMachines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Requirement", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Lifetime")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RequirementId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("RequirementName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("RequirementId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Requirements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Workpiece", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("Material")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorkpieceName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Workpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.WorkpieceProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("WorkpieceId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("WorkpieceId");
|
||||
|
||||
b.ToTable("WorkpieceProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ExecutionPhase", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("ExecutionPhases")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Machine", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.MachinePlanProduction", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Machine", "Machine")
|
||||
.WithMany("PlanProductions")
|
||||
.HasForeignKey("MachineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.PlanProduction", "PlanProduction")
|
||||
.WithMany("Machines")
|
||||
.HasForeignKey("PlanProductionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Machine");
|
||||
|
||||
b.Navigation("PlanProduction");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("PlanProductions")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.ExecutionPhase", "ExecutionPhase")
|
||||
.WithMany("PlanProductions")
|
||||
.HasForeignKey("ExecutionPhaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("ExecutionPhase");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProductionWorkpiece", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.PlanProduction", "PlanProduction")
|
||||
.WithMany("Workpieces")
|
||||
.HasForeignKey("PlanProductionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Workpiece", "Workpiece")
|
||||
.WithMany("PlanProductions")
|
||||
.HasForeignKey("WorkpieceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PlanProduction");
|
||||
|
||||
b.Navigation("Workpiece");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ProductMachine", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Machine", "Machine")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("MachineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Machines")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Machine");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Requirement", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Product", "Product")
|
||||
.WithOne("Requirement")
|
||||
.HasForeignKey("FactoryDatabaseImplement.Models.Requirement", "RequirementId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Workpiece", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Workpieces")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.WorkpieceProduct", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Workpieces")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Workpiece", "Workpiece")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("WorkpieceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Product");
|
||||
|
||||
b.Navigation("Workpiece");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("ExecutionPhases");
|
||||
|
||||
b.Navigation("PlanProductions");
|
||||
|
||||
b.Navigation("Workpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ExecutionPhase", b =>
|
||||
{
|
||||
b.Navigation("PlanProductions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Machine", b =>
|
||||
{
|
||||
b.Navigation("PlanProductions");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b =>
|
||||
{
|
||||
b.Navigation("Machines");
|
||||
|
||||
b.Navigation("Workpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Machines");
|
||||
|
||||
b.Navigation("Requirement")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Workpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Workpiece", b =>
|
||||
{
|
||||
b.Navigation("PlanProductions");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,401 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FactoryDatabaseImplement.Migrations
|
||||
{
|
||||
public partial class InitCreate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Clients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Login = table.Column<string>(type: "text", nullable: false),
|
||||
Email = table.Column<string>(type: "text", nullable: false),
|
||||
Password = table.Column<string>(type: "text", nullable: false),
|
||||
Role = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ExecutionPhases",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ClientId = table.Column<int>(type: "integer", nullable: false),
|
||||
ExecutionPhaseName = table.Column<string>(type: "text", nullable: false),
|
||||
ImplementerFIO = table.Column<string>(type: "text", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ExecutionPhases", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExecutionPhases_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Machines",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ClientId = table.Column<int>(type: "integer", nullable: false),
|
||||
MachineName = table.Column<string>(type: "text", nullable: false),
|
||||
ExploitationStartDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
|
||||
Lifetime = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Machines", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Machines_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Products",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ClientId = table.Column<int>(type: "integer", nullable: false),
|
||||
RequirementId = table.Column<int>(type: "integer", nullable: false),
|
||||
ProductName = table.Column<string>(type: "text", nullable: false),
|
||||
Price = table.Column<double>(type: "double precision", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Products", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Products_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Workpieces",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
WorkpieceName = table.Column<string>(type: "text", nullable: false),
|
||||
ClientId = table.Column<int>(type: "integer", nullable: false),
|
||||
Material = table.Column<string>(type: "text", nullable: false),
|
||||
Cost = table.Column<double>(type: "double precision", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Workpieces", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Workpieces_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlanProductions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ExecutionPhaseId = table.Column<int>(type: "integer", nullable: false),
|
||||
ClientId = table.Column<int>(type: "integer", nullable: false),
|
||||
ProductionName = table.Column<string>(type: "text", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false),
|
||||
Deadline = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlanProductions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlanProductions_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlanProductions_ExecutionPhases_ExecutionPhaseId",
|
||||
column: x => x.ExecutionPhaseId,
|
||||
principalTable: "ExecutionPhases",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProductMachines",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProductId = table.Column<int>(type: "integer", nullable: false),
|
||||
MachineId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProductMachines", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductMachines_Machines_MachineId",
|
||||
column: x => x.MachineId,
|
||||
principalTable: "Machines",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProductMachines_Products_ProductId",
|
||||
column: x => x.ProductId,
|
||||
principalTable: "Products",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Requirements",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ClientId = table.Column<int>(type: "integer", nullable: false),
|
||||
RequirementName = table.Column<string>(type: "text", nullable: false),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
Lifetime = table.Column<int>(type: "integer", nullable: false),
|
||||
RequirementId = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Requirements", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Requirements_Clients_ClientId",
|
||||
column: x => x.ClientId,
|
||||
principalTable: "Clients",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Requirements_Products_RequirementId",
|
||||
column: x => x.RequirementId,
|
||||
principalTable: "Products",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkpieceProducts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
WorkpieceId = table.Column<int>(type: "integer", nullable: false),
|
||||
ProductId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkpieceProducts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_WorkpieceProducts_Products_ProductId",
|
||||
column: x => x.ProductId,
|
||||
principalTable: "Products",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_WorkpieceProducts_Workpieces_WorkpieceId",
|
||||
column: x => x.WorkpieceId,
|
||||
principalTable: "Workpieces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MachinePlanProductions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
MachineId = table.Column<int>(type: "integer", nullable: false),
|
||||
PlanProductionId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MachinePlanProductions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MachinePlanProductions_Machines_MachineId",
|
||||
column: x => x.MachineId,
|
||||
principalTable: "Machines",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_MachinePlanProductions_PlanProductions_PlanProductionId",
|
||||
column: x => x.PlanProductionId,
|
||||
principalTable: "PlanProductions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlanProductionWorkpieces",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PlanProductionId = table.Column<int>(type: "integer", nullable: false),
|
||||
WorkpieceId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlanProductionWorkpieces", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlanProductionWorkpieces_PlanProductions_PlanProductionId",
|
||||
column: x => x.PlanProductionId,
|
||||
principalTable: "PlanProductions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PlanProductionWorkpieces_Workpieces_WorkpieceId",
|
||||
column: x => x.WorkpieceId,
|
||||
principalTable: "Workpieces",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExecutionPhases_ClientId",
|
||||
table: "ExecutionPhases",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MachinePlanProductions_MachineId",
|
||||
table: "MachinePlanProductions",
|
||||
column: "MachineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MachinePlanProductions_PlanProductionId",
|
||||
table: "MachinePlanProductions",
|
||||
column: "PlanProductionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Machines_ClientId",
|
||||
table: "Machines",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlanProductions_ClientId",
|
||||
table: "PlanProductions",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlanProductions_ExecutionPhaseId",
|
||||
table: "PlanProductions",
|
||||
column: "ExecutionPhaseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlanProductionWorkpieces_PlanProductionId",
|
||||
table: "PlanProductionWorkpieces",
|
||||
column: "PlanProductionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PlanProductionWorkpieces_WorkpieceId",
|
||||
table: "PlanProductionWorkpieces",
|
||||
column: "WorkpieceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductMachines_MachineId",
|
||||
table: "ProductMachines",
|
||||
column: "MachineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProductMachines_ProductId",
|
||||
table: "ProductMachines",
|
||||
column: "ProductId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Products_ClientId",
|
||||
table: "Products",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Requirements_ClientId",
|
||||
table: "Requirements",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Requirements_RequirementId",
|
||||
table: "Requirements",
|
||||
column: "RequirementId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkpieceProducts_ProductId",
|
||||
table: "WorkpieceProducts",
|
||||
column: "ProductId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkpieceProducts_WorkpieceId",
|
||||
table: "WorkpieceProducts",
|
||||
column: "WorkpieceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Workpieces_ClientId",
|
||||
table: "Workpieces",
|
||||
column: "ClientId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "MachinePlanProductions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlanProductionWorkpieces");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductMachines");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Requirements");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkpieceProducts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlanProductions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Machines");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Workpieces");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ExecutionPhases");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,544 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FactoryDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#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", "6.0.29")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ExecutionPhase", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ExecutionPhaseName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ImplementerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("ExecutionPhases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Machine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("ExploitationStartDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("Lifetime")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MachineName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Machines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.MachinePlanProduction", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MachineId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PlanProductionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MachineId");
|
||||
|
||||
b.HasIndex("PlanProductionId");
|
||||
|
||||
b.ToTable("MachinePlanProductions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Deadline")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("ExecutionPhaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ProductionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("ExecutionPhaseId");
|
||||
|
||||
b.ToTable("PlanProductions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProductionWorkpiece", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("PlanProductionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("WorkpieceId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlanProductionId");
|
||||
|
||||
b.HasIndex("WorkpieceId");
|
||||
|
||||
b.ToTable("PlanProductionWorkpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RequirementId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ProductMachine", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MachineId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MachineId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("ProductMachines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Requirement", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Lifetime")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RequirementId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("RequirementName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("RequirementId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Requirements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Workpiece", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<string>("Material")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorkpieceName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Workpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.WorkpieceProduct", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("WorkpieceId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("WorkpieceId");
|
||||
|
||||
b.ToTable("WorkpieceProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ExecutionPhase", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("ExecutionPhases")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Machine", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.MachinePlanProduction", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Machine", "Machine")
|
||||
.WithMany("PlanProductions")
|
||||
.HasForeignKey("MachineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.PlanProduction", "PlanProduction")
|
||||
.WithMany("Machines")
|
||||
.HasForeignKey("PlanProductionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Machine");
|
||||
|
||||
b.Navigation("PlanProduction");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("PlanProductions")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.ExecutionPhase", "ExecutionPhase")
|
||||
.WithMany("PlanProductions")
|
||||
.HasForeignKey("ExecutionPhaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("ExecutionPhase");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProductionWorkpiece", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.PlanProduction", "PlanProduction")
|
||||
.WithMany("Workpieces")
|
||||
.HasForeignKey("PlanProductionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Workpiece", "Workpiece")
|
||||
.WithMany("PlanProductions")
|
||||
.HasForeignKey("WorkpieceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PlanProduction");
|
||||
|
||||
b.Navigation("Workpiece");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ProductMachine", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Machine", "Machine")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("MachineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Machines")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Machine");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Requirement", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Product", "Product")
|
||||
.WithOne("Requirement")
|
||||
.HasForeignKey("FactoryDatabaseImplement.Models.Requirement", "RequirementId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Workpiece", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Workpieces")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.WorkpieceProduct", b =>
|
||||
{
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Product", "Product")
|
||||
.WithMany("Workpieces")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FactoryDatabaseImplement.Models.Workpiece", "Workpiece")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("WorkpieceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Product");
|
||||
|
||||
b.Navigation("Workpiece");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("ExecutionPhases");
|
||||
|
||||
b.Navigation("PlanProductions");
|
||||
|
||||
b.Navigation("Workpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.ExecutionPhase", b =>
|
||||
{
|
||||
b.Navigation("PlanProductions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Machine", b =>
|
||||
{
|
||||
b.Navigation("PlanProductions");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.PlanProduction", b =>
|
||||
{
|
||||
b.Navigation("Machines");
|
||||
|
||||
b.Navigation("Workpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Navigation("Machines");
|
||||
|
||||
b.Navigation("Requirement")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Workpieces");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FactoryDatabaseImplement.Models.Workpiece", b =>
|
||||
{
|
||||
b.Navigation("PlanProductions");
|
||||
|
||||
b.Navigation("Products");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ namespace FactoryDatabaseImplement.Models
|
||||
[Required]
|
||||
public int Lifetime { get; private set; }
|
||||
|
||||
public Dictionary<int, (IPlanProductionModel, int)> _machinePlanProductions { get; private set; } = new();
|
||||
private Dictionary<int, (IPlanProductionModel, int)> _machinePlanProductions = null;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IPlanProductionModel, int)> MachinePlanProductions
|
||||
|
@ -25,7 +25,7 @@ namespace FactoryDatabaseImplement.Models
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
public Dictionary<int, (IMachineModel, int)> _productMachines { get; private set; } = new();
|
||||
private Dictionary<int, (IMachineModel, int)> _productMachines = null;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, (IMachineModel, int)> ProductMachines
|
||||
|
Loading…
Reference in New Issue
Block a user