Move index creation to its own migration

This commit is contained in:
JPVenson
2026-05-24 12:04:40 +00:00
parent eece62a90b
commit 984e67c067
4 changed files with 1757 additions and 13 deletions

View File

@@ -1356,9 +1356,6 @@ namespace Jellyfin.Server.Implementations.Migrations
b.HasIndex("Username")
.IsUnique();
b.HasIndex("NormalizedUsername")
.IsUnique();
b.ToTable("Users");
b.HasAnnotation("Sqlite:UseSqlReturningClause", false);

View File

@@ -18,12 +18,6 @@ namespace Jellyfin.Server.Implementations.Migrations
maxLength: 255,
nullable: false,
defaultValue: string.Empty);
migrationBuilder.CreateIndex(
name: "IX_Users_NormalizedUsername",
table: "Users",
column: "NormalizedUsername",
unique: true);
}
/// <inheritdoc />
@@ -32,10 +26,6 @@ namespace Jellyfin.Server.Implementations.Migrations
migrationBuilder.DropColumn(
name: "NormalizedUsername",
table: "Users");
migrationBuilder.DropIndex(
name: "IX_Users_NormalizedUsername",
table: "Users");
}
}
}

View File

@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Jellyfin.Server.Implementations.Migrations
{
/// <inheritdoc />
public partial class AddUniqueNormalizedUsernameIndex : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_Users_NormalizedUsername",
table: "Users",
column: "NormalizedUsername",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Users_NormalizedUsername",
table: "Users");
}
}
}