Files
ersatztv/ErsatzTV.Infrastructure.MySql/Migrations/20251213203336_Add_SmartCollectionNameUnique.cs
T
Jason DoveandGitHub d8122edad6 fix duplicate smart collection names (#2720)
* fix duplicate smart collection names

* fix update error
2025-12-13 14:59:06 -06:00

51 lines
1.6 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ErsatzTV.Infrastructure.MySql.Migrations
{
/// <inheritdoc />
public partial class Add_SmartCollectionNameUnique : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "SmartCollection",
type: "varchar(255)",
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_SmartCollection_Name",
table: "SmartCollection",
column: "Name",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_SmartCollection_Name",
table: "SmartCollection");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "SmartCollection",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(255)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}