mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-19 12:14:45 -04:00
Fixed: Cleanup duplicated movie translations
This commit is contained in:
parent
6b81f92137
commit
55b9477a01
1 changed files with 27 additions and 0 deletions
|
@ -0,0 +1,27 @@
|
|||
using Dapper;
|
||||
using NzbDrone.Core.Datastore;
|
||||
|
||||
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||
{
|
||||
public class CleanupDuplicateMovieTranslations : IHousekeepingTask
|
||||
{
|
||||
private readonly IMainDatabase _database;
|
||||
|
||||
public CleanupDuplicateMovieTranslations(IMainDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
{
|
||||
using var mapper = _database.OpenConnection();
|
||||
|
||||
mapper.Execute(@"DELETE FROM ""MovieTranslations""
|
||||
WHERE ""Id"" IN (
|
||||
SELECT MAX(""Id"") FROM ""MovieTranslations""
|
||||
GROUP BY ""MovieMetadataId"", ""Language""
|
||||
HAVING COUNT(""Id"") > 1
|
||||
)");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue