//
using System;
using CanteenDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CanteenDatabaseImplement.Migrations
{
[DbContext(typeof(CanteenDatabase))]
[Migration("20230519185610_Init")]
partial class Init
{
///
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("CanteenDatabaseImplement.Models.Cook", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("ManagerId")
.HasColumnType("int");
b.Property("Position")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ManagerId");
b.ToTable("Cooks");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Dish", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("DishName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("ManagerId")
.HasColumnType("int");
b.Property("Price")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ManagerId");
b.ToTable("Dishes");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.DishProduct", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CountProducts")
.HasColumnType("int");
b.Property("DishId")
.HasColumnType("int");
b.Property("ProductId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DishId");
b.HasIndex("ProductId");
b.ToTable("DishProduct");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Lunch", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("DateCreate")
.HasColumnType("datetime2");
b.Property("DateImplement")
.HasColumnType("datetime2");
b.Property("LunchName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Status")
.HasColumnType("int");
b.Property("Sum")
.HasColumnType("float");
b.Property("VisitorId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VisitorId");
b.ToTable("Lunches");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.LunchOrder", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("LunchId")
.HasColumnType("int");
b.Property("OrderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LunchId");
b.HasIndex("OrderId");
b.ToTable("LunchOrder");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.LunchProduct", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CountProducts")
.HasColumnType("int");
b.Property("LunchId")
.HasColumnType("int");
b.Property("ProductId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LunchId");
b.HasIndex("ProductId");
b.ToTable("LunchProduct");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Manager", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("PhoneNumber")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Managers");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("VisitorId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VisitorId");
b.ToTable("Orders");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.OrderCook", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CookId")
.HasColumnType("int");
b.Property("OrderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CookId");
b.HasIndex("OrderId");
b.ToTable("OrderCook");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.OrderTableware", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CountTablewares")
.HasColumnType("int");
b.Property("OrderId")
.HasColumnType("int");
b.Property("TablewareId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("TablewareId");
b.ToTable("OrderTableware");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Product", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("ManagerId")
.HasColumnType("int");
b.Property("Price")
.HasColumnType("float");
b.Property("ProductName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("ManagerId");
b.ToTable("Products");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.ProductCook", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("CookId")
.HasColumnType("int");
b.Property("ProductId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CookId");
b.HasIndex("ProductId");
b.ToTable("ProductCook");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Tableware", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("TablewareName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("VisitorId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("VisitorId");
b.ToTable("Tablewares");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Visitor", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("FIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("PhoneNumber")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Visitors");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Cook", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Manager", "Manager")
.WithMany("Cooks")
.HasForeignKey("ManagerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manager");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Dish", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Manager", "Manager")
.WithMany("Dishes")
.HasForeignKey("ManagerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manager");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.DishProduct", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Dish", "Dish")
.WithMany("Products")
.HasForeignKey("DishId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("CanteenDatabaseImplement.Models.Product", "Product")
.WithMany("Dishes")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Dish");
b.Navigation("Product");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Lunch", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Visitor", "Visitor")
.WithMany("Lunches")
.HasForeignKey("VisitorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Visitor");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.LunchOrder", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Lunch", "Lunch")
.WithMany("Orders")
.HasForeignKey("LunchId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("CanteenDatabaseImplement.Models.Order", "Order")
.WithMany("Lunches")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Lunch");
b.Navigation("Order");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.LunchProduct", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Lunch", "Lunch")
.WithMany("Products")
.HasForeignKey("LunchId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("CanteenDatabaseImplement.Models.Product", "Product")
.WithMany("Lunches")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Lunch");
b.Navigation("Product");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Order", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Visitor", "Visitor")
.WithMany("Orders")
.HasForeignKey("VisitorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Visitor");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.OrderCook", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Cook", "Cook")
.WithMany("Orders")
.HasForeignKey("CookId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("CanteenDatabaseImplement.Models.Order", "Order")
.WithMany("Cooks")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Cook");
b.Navigation("Order");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.OrderTableware", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Order", "Order")
.WithMany("Tablewares")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("CanteenDatabaseImplement.Models.Tableware", "Tableware")
.WithMany("Orders")
.HasForeignKey("TablewareId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Order");
b.Navigation("Tableware");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Product", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Manager", "Manager")
.WithMany("Products")
.HasForeignKey("ManagerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manager");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.ProductCook", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Cook", "Cook")
.WithMany("Products")
.HasForeignKey("CookId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("CanteenDatabaseImplement.Models.Product", "Product")
.WithMany("Cooks")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Cook");
b.Navigation("Product");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Tableware", b =>
{
b.HasOne("CanteenDatabaseImplement.Models.Visitor", "Visitor")
.WithMany("Tablewares")
.HasForeignKey("VisitorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Visitor");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Cook", b =>
{
b.Navigation("Orders");
b.Navigation("Products");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Dish", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Lunch", b =>
{
b.Navigation("Orders");
b.Navigation("Products");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Manager", b =>
{
b.Navigation("Cooks");
b.Navigation("Dishes");
b.Navigation("Products");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Order", b =>
{
b.Navigation("Cooks");
b.Navigation("Lunches");
b.Navigation("Tablewares");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Product", b =>
{
b.Navigation("Cooks");
b.Navigation("Dishes");
b.Navigation("Lunches");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Tableware", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("CanteenDatabaseImplement.Models.Visitor", b =>
{
b.Navigation("Lunches");
b.Navigation("Orders");
b.Navigation("Tablewares");
});
#pragma warning restore 612, 618
}
}
}