//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PizzeriaDatabaseImplement;
#nullable disable
namespace PizzeriaDatabaseImplement.Migrations
{
[DbContext(typeof(PizzeriaDatabase))]
[Migration("20230228065928_Change constraint")]
partial class Changeconstraint
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Component", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ComponentName")
.IsRequired()
.HasColumnType("text");
b.Property("Cost")
.HasColumnType("double precision");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Count")
.HasColumnType("integer");
b.Property("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property("DateImplement")
.HasColumnType("timestamp with time zone");
b.Property("PizzaId")
.HasColumnType("integer");
b.Property("Status")
.HasColumnType("integer");
b.Property("Sum")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("PizzaId");
b.ToTable("Orders");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Pizza", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("PizzaName")
.IsRequired()
.HasColumnType("text");
b.Property("Price")
.HasColumnType("double precision");
b.HasKey("Id");
b.ToTable("Pizzas");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.models.PizzaComponent", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ComponentId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.Property("PizzaId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PizzaId");
b.ToTable("PizzaComponents");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Order", b =>
{
b.HasOne("PizzeriaDatabaseImplement.models.Pizza", "Pizza")
.WithMany("Orders")
.HasForeignKey("PizzaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Pizza");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.models.PizzaComponent", b =>
{
b.HasOne("PizzeriaDatabaseImplement.models.Component", "Component")
.WithMany("PizzaComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PizzeriaDatabaseImplement.models.Pizza", "Pizza")
.WithMany("Components")
.HasForeignKey("PizzaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Pizza");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Component", b =>
{
b.Navigation("PizzaComponents");
});
modelBuilder.Entity("PizzeriaDatabaseImplement.models.Pizza", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
});
#pragma warning restore 612, 618
}
}
}