|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
|
|
|
|
|
namespace WebAPI.Migrations
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public partial class bookreview : Migration
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Books",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
BookId = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
|
|
|
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
ISBN = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
|
|
|
},
|
|
|
|
|
constraints: table =>
|
|
|
|
|
{
|
|
|
|
|
table.PrimaryKey("PK_Books", x => x.BookId);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
migrationBuilder.CreateTable(
|
|
|
|
|
name: "Reviews",
|
|
|
|
|
columns: table => new
|
|
|
|
|
{
|
|
|
|
|
ReviewId = table.Column<int>(type: "int", nullable: false)
|
|
|
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
|
|
|
Context = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
|
|
|
BookId = table.Column<int>(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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Reviews");
|
|
|
|
|
|
|
|
|
|
migrationBuilder.DropTable(
|
|
|
|
|
name: "Books");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|