43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace FinlyticAssets.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UpdateDynamicSettingsUniqueIndex : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql(@"
|
|
DELETE FROM ""DynamicSettings"" a USING ""DynamicSettings"" b
|
|
WHERE a.""Key"" = b.""Key"" AND a.""Id"" < b.""Id"";
|
|
");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DynamicSettings_Key",
|
|
table: "DynamicSettings");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DynamicSettings_Key",
|
|
table: "DynamicSettings",
|
|
column: "Key",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DynamicSettings_Key",
|
|
table: "DynamicSettings");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DynamicSettings_Key",
|
|
table: "DynamicSettings",
|
|
column: "Key");
|
|
}
|
|
}
|
|
}
|