diff --git a/backend/api/Migrations/20230908083418_AddDefaultLocalizationAreaToDeck.cs b/backend/api/Migrations/20230908083418_AddDefaultLocalizationAreaToDeck.cs index df9501993..e3a4083c6 100644 --- a/backend/api/Migrations/20230908083418_AddDefaultLocalizationAreaToDeck.cs +++ b/backend/api/Migrations/20230908083418_AddDefaultLocalizationAreaToDeck.cs @@ -10,13 +10,106 @@ public partial class AddDefaultLocalizationAreaToDeck : Migration /// 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( + name: "AreaId", + table: "Decks", + type: "nvarchar(450)", + nullable: true); + + migrationBuilder.AddColumn( + 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); } /// 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( + 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); } } }