//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebAPI.Data;
#nullable disable
namespace WebAPI.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20230828043008_book-review2")]
partial class bookreview2
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SharedData.Models.Book", b =>
{
b.Property("BookId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("BookId"));
b.Property("ISBN")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("BookId");
b.ToTable("Books");
});
modelBuilder.Entity("SharedData.Models.GameResult", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("Date")
.HasColumnType("datetime2");
b.Property("Score")
.HasColumnType("int");
b.Property("UserId")
.HasColumnType("int");
b.Property("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("GameResults");
});
modelBuilder.Entity("SharedData.Models.Review", b =>
{
b.Property("ReviewId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ReviewId"));
b.Property("BookId")
.HasColumnType("int");
b.Property("Context")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("ReviewId");
b.HasIndex("BookId");
b.ToTable("Reviews");
});
modelBuilder.Entity("SharedData.Models.Review", b =>
{
b.HasOne("SharedData.Models.Book", null)
.WithMany("Reviews")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("SharedData.Models.Book", b =>
{
b.Navigation("Reviews");
});
#pragma warning restore 612, 618
}
}
}