//
using System;
using BookShopDataBaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace BookShopDataBaseImplement.Migrations
{
[DbContext(typeof(BookShopDatabase))]
partial class BookShopDatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("BookShopDataBaseImplement.Models.Author", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AuthorName")
.IsRequired()
.HasColumnType("text");
b.Property("AuthorPatronymic")
.IsRequired()
.HasColumnType("text");
b.Property("AuthorSurname")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Authors");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Book", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("BookName")
.IsRequired()
.HasColumnType("text");
b.Property("Cost")
.HasColumnType("double precision");
b.Property("Count")
.HasColumnType("integer");
b.Property("GenreId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("GenreId");
b.ToTable("Books");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.BookAuthor", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AuthorId")
.HasColumnType("integer");
b.Property("BookId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.HasIndex("BookId");
b.ToTable("BookAuthors");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Client", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("ClientName")
.IsRequired()
.HasColumnType("text");
b.Property("ClientPatronymic")
.IsRequired()
.HasColumnType("text");
b.Property("ClientSurname")
.IsRequired()
.HasColumnType("text");
b.Property("Email")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Genre", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("GenreName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Genres");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Order", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("BookId")
.HasColumnType("integer");
b.Property("ClientId")
.HasColumnType("integer");
b.Property("Count")
.HasColumnType("integer");
b.Property("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property("Sum")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("BookId");
b.HasIndex("ClientId");
b.ToTable("Orders");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Book", b =>
{
b.HasOne("BookShopDataBaseImplement.Models.Genre", "Genre")
.WithMany("Books")
.HasForeignKey("GenreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Genre");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.BookAuthor", b =>
{
b.HasOne("BookShopDataBaseImplement.Models.Author", "Author")
.WithMany("BookAuthors")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookShopDataBaseImplement.Models.Book", "Book")
.WithMany("Authors")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Book");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Order", b =>
{
b.HasOne("BookShopDataBaseImplement.Models.Book", "Book")
.WithMany("Orders")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookShopDataBaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Client");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Author", b =>
{
b.Navigation("BookAuthors");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Book", b =>
{
b.Navigation("Authors");
b.Navigation("Orders");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("BookShopDataBaseImplement.Models.Genre", b =>
{
b.Navigation("Books");
});
#pragma warning restore 612, 618
}
}
}