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.
Radarr/src/NzbDrone.Core/Datastore/Migration/150_fix_format_tags_double_...

31 lines
958 B

using System.Data;
using System.Text.RegularExpressions;
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(150)]
public class fix_format_tags_double_underscore : NzbDroneMigrationBase
{
public static Regex DoubleUnderscore = new Regex(@"^(?<type>R|S|M|E|L|C|I|G)__(?<value>.*)$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
protected override void MainDbUpgrade()
{
Execute.WithConnection(ConvertExistingFormatTags);
}
private void ConvertExistingFormatTags(IDbConnection conn, IDbTransaction tran)
{
var updater = new CustomFormatUpdater149(conn, tran);
updater.ReplaceInTags(DoubleUnderscore, match =>
{
return $"{match.Groups["type"].Value}_{match.Groups["value"].Value}";
});
updater.Commit();
}
}
}