Browse Source

fix some mysql migrations that failed on mariadb (#2725)

pull/2726/head
Jason Dove 2 weeks ago committed by GitHub
parent
commit
e4f1a93db0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      ErsatzTV.Infrastructure.MySql/Migrations/20251213202531_Fix_DuplicateSmartCollectionName.cs
  2. 11
      ErsatzTV.Infrastructure.MySql/Migrations/20251214002940_Fix_SmartCollectionNameSensitivity.cs

11
ErsatzTV.Infrastructure.MySql/Migrations/20251213202531_Fix_DuplicateSmartCollectionName.cs

@ -12,16 +12,15 @@ namespace ErsatzTV.Infrastructure.MySql.Migrations @@ -12,16 +12,15 @@ namespace ErsatzTV.Infrastructure.MySql.Migrations
{
migrationBuilder.Sql(
@"
WITH Numbered AS (
UPDATE SmartCollection sc
JOIN (
SELECT
Id,
ROW_NUMBER() OVER (PARTITION BY Name ORDER BY Id) as RowNum
FROM SmartCollection
)
UPDATE SmartCollection sc
JOIN Numbered n ON sc.Id = n.Id
SET sc.Name = CONCAT(sc.Name, ' (', n.RowNum - 1, ')')
WHERE n.RowNum > 1;
) n ON sc.Id = n.Id
SET sc.Name = CONCAT(sc.Name, ' (', n.RowNum - 1, ')')
WHERE n.RowNum > 1;
");
}

11
ErsatzTV.Infrastructure.MySql/Migrations/20251214002940_Fix_SmartCollectionNameSensitivity.cs

@ -12,16 +12,15 @@ namespace ErsatzTV.Infrastructure.MySql.Migrations @@ -12,16 +12,15 @@ namespace ErsatzTV.Infrastructure.MySql.Migrations
{
migrationBuilder.Sql(
@"
WITH Numbered AS (
UPDATE SmartCollection sc
JOIN (
SELECT
Id,
ROW_NUMBER() OVER (PARTITION BY LOWER(Name) ORDER BY Id) as RowNum
FROM SmartCollection
)
UPDATE SmartCollection sc
JOIN Numbered n ON sc.Id = n.Id
SET sc.Name = CONCAT(sc.Name, ' (', n.RowNum - 1, ')')
WHERE n.RowNum > 1;
) n ON sc.Id = n.Id
SET sc.Name = CONCAT(sc.Name, ' (', n.RowNum - 1, ')')
WHERE n.RowNum > 1;
");
migrationBuilder.AlterColumn<string>(

Loading…
Cancel
Save