Add 3 part migration for normalized Username

This commit is contained in:
JPVenson
2026-05-22 17:31:45 +00:00
parent 6435600a9c
commit 999de06d6b
3 changed files with 76 additions and 9 deletions

View File

@@ -10,21 +10,13 @@ namespace Jellyfin.Server.Implementations.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// this is the first part of the migration. Add the column.
migrationBuilder.AddColumn<string>(
name: "NormalizedUsername",
table: "Users",
type: "TEXT",
maxLength: 255,
nullable: true);
migrationBuilder.Sql("""
UPDATE "Users" SET "NormalizedUsername" = UPPER("Username")
""");
migrationBuilder.AlterColumn<string>(
name: "NormalizedUsername",
table: "Users",
type: "TEXT",
maxLength: 255,
nullable: false);
}
/// <inheritdoc />

View File

@@ -0,0 +1,31 @@
using Jellyfin.Database.Implementations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Jellyfin.Server.Implementations.Migrations
{
/// <inheritdoc />
[DbContext(typeof(JellyfinDbContext))]
[Migration("20260522092305_UpdateNormalizedUsername")]
public partial class UpdateNormalizedUsername : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// this is the 3rd part of the NormalizedUsername migration.
migrationBuilder.AlterColumn<string>(
name: "NormalizedUsername",
table: "Users",
type: "TEXT",
maxLength: 255,
nullable: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}