using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace LibraryAPI.Migrations { public partial class RenameTables : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Book_Author_AuthorId", table: "Book"); migrationBuilder.DropPrimaryKey( name: "PK_Book", table: "Book"); migrationBuilder.DropPrimaryKey( name: "PK_Author", table: "Author"); migrationBuilder.RenameTable( name: "Book", newName: "Books"); migrationBuilder.RenameTable( name: "Author", newName: "Authors"); migrationBuilder.RenameIndex( name: "IX_Book_AuthorId", table: "Books", newName: "IX_Books_AuthorId"); migrationBuilder.AddPrimaryKey( name: "PK_Books", table: "Books", column: "Id"); migrationBuilder.AddPrimaryKey( name: "PK_Authors", table: "Authors", column: "Id"); migrationBuilder.AddForeignKey( name: "FK_Books_Authors_AuthorId", table: "Books", column: "AuthorId", principalTable: "Authors", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Books_Authors_AuthorId", table: "Books"); migrationBuilder.DropPrimaryKey( name: "PK_Books", table: "Books"); migrationBuilder.DropPrimaryKey( name: "PK_Authors", table: "Authors"); migrationBuilder.RenameTable( name: "Books", newName: "Book"); migrationBuilder.RenameTable( name: "Authors", newName: "Author"); migrationBuilder.RenameIndex( name: "IX_Books_AuthorId", table: "Book", newName: "IX_Book_AuthorId"); migrationBuilder.AddPrimaryKey( name: "PK_Book", table: "Book", column: "Id"); migrationBuilder.AddPrimaryKey( name: "PK_Author", table: "Author", column: "Id"); migrationBuilder.AddForeignKey( name: "FK_Book_Author_AuthorId", table: "Book", column: "AuthorId", principalTable: "Author", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }