Skip to content

Commit

Permalink
Add missing migration (dotnet-architecture#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
efleming18 authored and ardalis committed Sep 11, 2019
1 parent 1cc0e51 commit c370b8a
Show file tree
Hide file tree
Showing 3 changed files with 383 additions and 5 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace Microsoft.eShopWeb.Infrastructure.Data.Migrations
{
public partial class UpdateCatalogModels : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
table: "Catalog");

migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
table: "Catalog");

migrationBuilder.DropPrimaryKey(
name: "PK_CatalogTypes",
table: "CatalogTypes");

migrationBuilder.DropPrimaryKey(
name: "PK_CatalogBrands",
table: "CatalogBrands");

migrationBuilder.RenameTable(
name: "CatalogTypes",
newName: "CatalogType");

migrationBuilder.RenameTable(
name: "CatalogBrands",
newName: "CatalogBrand");

migrationBuilder.AlterColumn<string>(
name: "BuyerId",
table: "Baskets",
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 20);

migrationBuilder.AddPrimaryKey(
name: "PK_CatalogType",
table: "CatalogType",
column: "Id");

migrationBuilder.AddPrimaryKey(
name: "PK_CatalogBrand",
table: "CatalogBrand",
column: "Id");

migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
table: "Catalog",
column: "CatalogBrandId",
principalTable: "CatalogBrand",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);

migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
table: "Catalog",
column: "CatalogTypeId",
principalTable: "CatalogType",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogBrand_CatalogBrandId",
table: "Catalog");

migrationBuilder.DropForeignKey(
name: "FK_Catalog_CatalogType_CatalogTypeId",
table: "Catalog");

migrationBuilder.DropPrimaryKey(
name: "PK_CatalogType",
table: "CatalogType");

migrationBuilder.DropPrimaryKey(
name: "PK_CatalogBrand",
table: "CatalogBrand");

migrationBuilder.RenameTable(
name: "CatalogType",
newName: "CatalogTypes");

migrationBuilder.RenameTable(
name: "CatalogBrand",
newName: "CatalogBrands");

migrationBuilder.AlterColumn<string>(
name: "BuyerId",
table: "Baskets",
maxLength: 20,
nullable: false,
oldClrType: typeof(string),
oldNullable: true);

migrationBuilder.AddPrimaryKey(
name: "PK_CatalogTypes",
table: "CatalogTypes",
column: "Id");

migrationBuilder.AddPrimaryKey(
name: "PK_CatalogBrands",
table: "CatalogBrands",
column: "Id");

migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogBrands_CatalogBrandId",
table: "Catalog",
column: "CatalogBrandId",
principalTable: "CatalogBrands",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);

migrationBuilder.AddForeignKey(
name: "FK_Catalog_CatalogTypes_CatalogTypeId",
table: "Catalog",
column: "CatalogTypeId",
principalTable: "CatalogTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}
Loading

0 comments on commit c370b8a

Please sign in to comment.