54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace LibraryDatabase.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class InitialCreate : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "authors",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
author_id = table.Column<int>(type: "int", nullable: false)
|
|||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|||
|
author_name = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_authors", x => x.author_id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "books",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
book_id = table.Column<int>(type: "int", nullable: false)
|
|||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|||
|
book_name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|||
|
book_cover = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|||
|
book_author_name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|||
|
book_release_date = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_books", x => x.book_id);
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "authors");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "books");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|