using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Commerce.Domain.Migrations { /// public partial class ModelUpdate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Categorys_Categorys_ParentCategoryId", table: "Categorys"); migrationBuilder.DropForeignKey( name: "FK_Products_Categorys_CategoryId", table: "Products"); migrationBuilder.DropPrimaryKey( name: "PK_Categorys", table: "Categorys"); migrationBuilder.RenameTable( name: "Categorys", newName: "Categories"); migrationBuilder.RenameIndex( name: "IX_Categorys_ParentCategoryId", table: "Categories", newName: "IX_Categories_ParentCategoryId"); migrationBuilder.AddPrimaryKey( name: "PK_Categories", table: "Categories", column: "Id"); migrationBuilder.AddForeignKey( name: "FK_Categories_Categories_ParentCategoryId", table: "Categories", column: "ParentCategoryId", principalTable: "Categories", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_Products_Categories_CategoryId", table: "Products", column: "CategoryId", principalTable: "Categories", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Categories_Categories_ParentCategoryId", table: "Categories"); migrationBuilder.DropForeignKey( name: "FK_Products_Categories_CategoryId", table: "Products"); migrationBuilder.DropPrimaryKey( name: "PK_Categories", table: "Categories"); migrationBuilder.RenameTable( name: "Categories", newName: "Categorys"); migrationBuilder.RenameIndex( name: "IX_Categories_ParentCategoryId", table: "Categorys", newName: "IX_Categorys_ParentCategoryId"); migrationBuilder.AddPrimaryKey( name: "PK_Categorys", table: "Categorys", column: "Id"); migrationBuilder.AddForeignKey( name: "FK_Categorys_Categorys_ParentCategoryId", table: "Categorys", column: "ParentCategoryId", principalTable: "Categorys", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_Products_Categorys_CategoryId", table: "Products", column: "CategoryId", principalTable: "Categorys", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }