forked from dotnet-architecture/eShopOnWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing migration (dotnet-architecture#298)
- Loading branch information
1 parent
1cc0e51
commit c370b8a
Showing
3 changed files
with
383 additions
and
5 deletions.
There are no files selected for viewing
252 changes: 252 additions & 0 deletions
252
src/Infrastructure/Data/Migrations/20190911011026_UpdateCatalogModels.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
128 changes: 128 additions & 0 deletions
128
src/Infrastructure/Data/Migrations/20190911011026_UpdateCatalogModels.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
Oops, something went wrong.