You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Core/Datastore/Migration/014_fix_language_metadata_p...

25 lines
995 B

using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(14)]
public class fix_language_metadata_profiles : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Execute.Sql("UPDATE artists SET metadataProfileId = " +
"CASE WHEN ((SELECT COUNT(*) FROM metadataprofiles) > 0) " +
"THEN (SELECT id FROM metadataprofiles ORDER BY id ASC LIMIT 1) " +
"ELSE 0 END " +
"WHERE artists.metadataProfileId == 0");
Execute.Sql("UPDATE artists SET languageProfileId = " +
"CASE WHEN ((SELECT COUNT(*) FROM languageprofiles) > 0) " +
"THEN (SELECT id FROM languageprofiles ORDER BY id ASC LIMIT 1) " +
"ELSE 0 END " +
"WHERE artists.languageProfileId == 0");
}
}
}