Skip to content

Commit

Permalink
Add Up and Down method
Browse files Browse the repository at this point in the history
  • Loading branch information
oysand committed Sep 12, 2023
1 parent cbb4d51 commit 91b292a
Showing 1 changed file with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,106 @@ public partial class AddDefaultLocalizationAreaToDeck : Migration
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Areas_Decks_DeckId",
table: "Areas");

migrationBuilder.DropIndex(
name: "IX_Areas_DeckId",
table: "Areas");

migrationBuilder.DropColumn(
name: "DeckId",
table: "Areas");

migrationBuilder.AddColumn<string>(
name: "AreaId",
table: "Decks",
type: "nvarchar(450)",
nullable: true);

migrationBuilder.AddColumn<string>(
name: "DefaultLocalizationAreaId",
table: "Decks",
type: "nvarchar(450)",
nullable: true);

migrationBuilder.CreateIndex(
name: "IX_Decks_AreaId",
table: "Decks",
column: "AreaId",
unique: true,
filter: "[AreaId] IS NOT NULL");

migrationBuilder.CreateIndex(
name: "IX_Decks_DefaultLocalizationAreaId",
table: "Decks",
column: "DefaultLocalizationAreaId",
unique: true,
filter: "[DefaultLocalizationAreaId] IS NOT NULL");

migrationBuilder.AddForeignKey(
name: "FK_Decks_Areas_AreaId",
table: "Decks",
column: "AreaId",
principalTable: "Areas",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);

migrationBuilder.AddForeignKey(
name: "FK_Decks_Areas_DefaultLocalizationAreaId",
table: "Decks",
column: "DefaultLocalizationAreaId",
principalTable: "Areas",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Decks_Areas_AreaId",
table: "Decks");

migrationBuilder.DropForeignKey(
name: "FK_Decks_Areas_DefaultLocalizationAreaId",
table: "Decks");

migrationBuilder.DropIndex(
name: "IX_Decks_AreaId",
table: "Decks");

migrationBuilder.DropIndex(
name: "IX_Decks_DefaultLocalizationAreaId",
table: "Decks");

migrationBuilder.DropColumn(
name: "AreaId",
table: "Decks");

migrationBuilder.DropColumn(
name: "DefaultLocalizationAreaId",
table: "Decks");

migrationBuilder.AddColumn<string>(
name: "DeckId",
table: "Areas",
type: "nvarchar(450)",
nullable: true);

migrationBuilder.CreateIndex(
name: "IX_Areas_DeckId",
table: "Areas",
column: "DeckId");

migrationBuilder.AddForeignKey(
name: "FK_Areas_Decks_DeckId",
table: "Areas",
column: "DeckId",
principalTable: "Decks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

0 comments on commit 91b292a

Please sign in to comment.