mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-17 15:02:34 +02:00
Fixed: Alternative Titles appearing multiple times. Duplicate alt titles will be deleted. Fixes #2040
This commit is contained in:
parent
e7c9217dc0
commit
25b0a52ba6
@ -59,7 +59,7 @@ protected void Delete(Expression<Func<TModel, bool>> filter)
|
||||
|
||||
public IEnumerable<TModel> All()
|
||||
{
|
||||
return DataMapper.Query<TModel>().ToList();
|
||||
return Query.ToList();
|
||||
}
|
||||
|
||||
public int Count()
|
||||
|
@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using FluentMigrator;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(141)]
|
||||
public class fix_duplicate_alt_titles : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Execute.WithConnection(RenameUrlToBaseUrl);
|
||||
Alter.Table("AlternativeTitles").AlterColumn("CleanTitle").AsString().Unique();
|
||||
}
|
||||
|
||||
private void RenameUrlToBaseUrl(IDbConnection conn, IDbTransaction tran)
|
||||
{
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.Transaction = tran;
|
||||
cmd.CommandText = "DELETE FROM AlternativeTitles WHERE rowid NOT IN ( SELECT MIN(rowid) FROM AlternativeTitles GROUP BY CleanTitle )";
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -126,6 +126,7 @@
|
||||
<Compile Include="Authentication\UserService.cs" />
|
||||
<Compile Include="Datastore\Migration\123_create_netimport_table.cs" />
|
||||
<Compile Include="Datastore\Migration\140_add_alternative_titles_table.cs" />
|
||||
<Compile Include="Datastore\Migration\141_fix_duplicate_alt_titles.cs" />
|
||||
<Compile Include="Housekeeping\Housekeepers\CleanupOrphanedAlternativeTitles.cs" />
|
||||
<Compile Include="MediaFiles\Events\MovieFileUpdatedEvent.cs" />
|
||||
<Compile Include="Datastore\Migration\134_add_remux_qualities_for_the_wankers.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user