using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace WebAPI.Migrations { /// public partial class bookreview : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Books", columns: table => new { BookId = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Title = table.Column(type: "nvarchar(max)", nullable: false), ISBN = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Books", x => x.BookId); }); migrationBuilder.CreateTable( name: "Reviews", columns: table => new { ReviewId = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Context = table.Column(type: "nvarchar(max)", nullable: false), BookId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Reviews", x => x.ReviewId); table.ForeignKey( name: "FK_Reviews_Books_BookId", column: x => x.BookId, principalTable: "Books", principalColumn: "BookId"); }); migrationBuilder.CreateIndex( name: "IX_Reviews_BookId", table: "Reviews", column: "BookId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Reviews"); migrationBuilder.DropTable( name: "Books"); } } }