//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using RestaurantDatabaseImplement;
#nullable disable
namespace RestaurantDatabaseImplement.Migrations
{
[DbContext(typeof(RestaurantDatabase))]
[Migration("20230516191214_migr2")]
partial class migr2
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Client", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("FirstName")
.IsRequired()
.HasColumnType("text");
b.Property("LastName")
.IsRequired()
.HasColumnType("text");
b.Property("Number")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Component", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Count")
.HasColumnType("integer");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.Property("Price")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.ComponentProvider", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ComponentId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("ProviderId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("ProviderId");
b.ToTable("ComponentProviders");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClientId")
.HasColumnType("integer");
b.Property("Date")
.HasColumnType("timestamp with time zone");
b.Property("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Orders");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.OrderProduct", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Count")
.HasColumnType("integer");
b.Property("OrderId")
.HasColumnType("integer");
b.Property("ProductId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProductId");
b.ToTable("OrderProducts");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Product", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Count")
.HasColumnType("integer");
b.Property("Price")
.HasColumnType("double precision");
b.Property("Type")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Products");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.ProductComponent", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ComponentId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.Property("ProductId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("ProductId");
b.ToTable("ProductComponents");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Provider", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Address")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Providers");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.ComponentProvider", b =>
{
b.HasOne("RestaurantDatabaseImplement.Models.Component", "Component")
.WithMany("Providers")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RestaurantDatabaseImplement.Models.Provider", "Provider")
.WithMany("ComponentProviders")
.HasForeignKey("ProviderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Provider");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Order", b =>
{
b.HasOne("RestaurantDatabaseImplement.Models.Client", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.OrderProduct", b =>
{
b.HasOne("RestaurantDatabaseImplement.Models.Order", "Order")
.WithMany("Products")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RestaurantDatabaseImplement.Models.Product", "Product")
.WithMany("OrderProducts")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Product");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.ProductComponent", b =>
{
b.HasOne("RestaurantDatabaseImplement.Models.Component", "Component")
.WithMany("ProductComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RestaurantDatabaseImplement.Models.Product", "Product")
.WithMany("Components")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Product");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Component", b =>
{
b.Navigation("ProductComponents");
b.Navigation("Providers");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Order", b =>
{
b.Navigation("Products");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Product", b =>
{
b.Navigation("Components");
b.Navigation("OrderProducts");
});
modelBuilder.Entity("RestaurantDatabaseImplement.Models.Provider", b =>
{
b.Navigation("ComponentProviders");
});
#pragma warning restore 612, 618
}
}
}