ISEbd-22. Baygulov A.A. Lab work 06 #9

Closed
tellsense wants to merge 11 commits from lab6 into lab5
4 changed files with 115 additions and 3 deletions
Showing only changes of commit d93dd5adf3 - Show all commits

View File

@ -12,7 +12,7 @@ using SushiBarDatabaseImplement;
namespace SushiBarDatabaseImplement.Migrations
{
[DbContext(typeof(SushiBarDatabase))]
[Migration("20240504130916_Initial")]
[Migration("20240504140537_Initial")]
partial class Initial
{
/// <inheritdoc />
@ -50,6 +50,33 @@ namespace SushiBarDatabaseImplement.Migrations
b.ToTable("Clients");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Qualification")
.HasColumnType("integer");
b.Property<int>("WorkExperience")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
@ -90,6 +117,9 @@ namespace SushiBarDatabaseImplement.Migrations
b.Property<DateTime?>("DateImplement")
.HasColumnType("timestamp without time zone");
b.Property<int?>("ImplementerId")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
@ -103,6 +133,8 @@ namespace SushiBarDatabaseImplement.Migrations
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("SushiId");
b.ToTable("Orders");
@ -162,6 +194,10 @@ namespace SushiBarDatabaseImplement.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SushiBarDatabaseImplement.Implementer", null)
.WithMany("Order")
.HasForeignKey("ImplementerId");
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
.WithMany("Orders")
.HasForeignKey("SushiId")
@ -197,6 +233,11 @@ namespace SushiBarDatabaseImplement.Migrations
b.Navigation("Orders");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Implementer", b =>
{
b.Navigation("Order");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
{
b.Navigation("SushiComponents");

View File

@ -41,6 +41,22 @@ namespace SushiBarDatabaseImplement.Migrations
table.PrimaryKey("PK_Components", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Implementers",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ImplementerFIO = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false),
WorkExperience = table.Column<int>(type: "integer", nullable: false),
Qualification = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Implementers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Sushis",
columns: table => new
@ -67,7 +83,8 @@ namespace SushiBarDatabaseImplement.Migrations
Sum = table.Column<double>(type: "double precision", nullable: false),
Status = table.Column<int>(type: "integer", nullable: false),
DateCreate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
DateImplement = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
DateImplement = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
ImplementerId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
@ -78,6 +95,11 @@ namespace SushiBarDatabaseImplement.Migrations
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Orders_Implementers_ImplementerId",
column: x => x.ImplementerId,
principalTable: "Implementers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Orders_Sushis_SushiId",
column: x => x.SushiId,
@ -118,6 +140,11 @@ namespace SushiBarDatabaseImplement.Migrations
table: "Orders",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Orders_ImplementerId",
table: "Orders",
column: "ImplementerId");
migrationBuilder.CreateIndex(
name: "IX_Orders_SushiId",
table: "Orders",
@ -146,6 +173,9 @@ namespace SushiBarDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "Implementers");
migrationBuilder.DropTable(
name: "Components");

View File

@ -47,6 +47,33 @@ namespace SushiBarDatabaseImplement.Migrations
b.ToTable("Clients");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<int>("Qualification")
.HasColumnType("integer");
b.Property<int>("WorkExperience")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
@ -87,6 +114,9 @@ namespace SushiBarDatabaseImplement.Migrations
b.Property<DateTime?>("DateImplement")
.HasColumnType("timestamp without time zone");
b.Property<int?>("ImplementerId")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
@ -100,6 +130,8 @@ namespace SushiBarDatabaseImplement.Migrations
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("SushiId");
b.ToTable("Orders");
@ -159,6 +191,10 @@ namespace SushiBarDatabaseImplement.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SushiBarDatabaseImplement.Implementer", null)
Review

Связь настроена не до конца

Связь настроена не до конца
.WithMany("Order")
.HasForeignKey("ImplementerId");
b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi")
.WithMany("Orders")
.HasForeignKey("SushiId")
@ -194,6 +230,11 @@ namespace SushiBarDatabaseImplement.Migrations
b.Navigation("Orders");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Implementer", b =>
{
b.Navigation("Order");
});
modelBuilder.Entity("SushiBarDatabaseImplement.Models.Component", b =>
{
b.Navigation("SushiComponents");

View File

@ -15,7 +15,7 @@ namespace SushiBarDatabaseImplement
{
if (OptionsBuilder.IsConfigured == false)
{
OptionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBarFull5;Username=postgres;Password=postgres");
OptionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBarFull6;Username=postgres;Password=postgres");
}
base.OnConfiguring(OptionsBuilder);