From e4f1a93db0445f232eb81c693fb66c4a969ffbca Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:40:03 -0600 Subject: [PATCH] fix some mysql migrations that failed on mariadb (#2725) --- ...20251213202531_Fix_DuplicateSmartCollectionName.cs | 11 +++++------ ...251214002940_Fix_SmartCollectionNameSensitivity.cs | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ErsatzTV.Infrastructure.MySql/Migrations/20251213202531_Fix_DuplicateSmartCollectionName.cs b/ErsatzTV.Infrastructure.MySql/Migrations/20251213202531_Fix_DuplicateSmartCollectionName.cs index 5becdf239..74dfc7c23 100644 --- a/ErsatzTV.Infrastructure.MySql/Migrations/20251213202531_Fix_DuplicateSmartCollectionName.cs +++ b/ErsatzTV.Infrastructure.MySql/Migrations/20251213202531_Fix_DuplicateSmartCollectionName.cs @@ -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; "); } diff --git a/ErsatzTV.Infrastructure.MySql/Migrations/20251214002940_Fix_SmartCollectionNameSensitivity.cs b/ErsatzTV.Infrastructure.MySql/Migrations/20251214002940_Fix_SmartCollectionNameSensitivity.cs index b2ce3048d..3b61ee41c 100644 --- a/ErsatzTV.Infrastructure.MySql/Migrations/20251214002940_Fix_SmartCollectionNameSensitivity.cs +++ b/ErsatzTV.Infrastructure.MySql/Migrations/20251214002940_Fix_SmartCollectionNameSensitivity.cs @@ -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(