mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-29 11:05:44 +00:00
aac42d4882
Fix: Season Ignore is handled separately from Episode Ignore.
29 lines
No EOL
1.3 KiB
C#
29 lines
No EOL
1.3 KiB
C#
using System;
|
|
using System.Data;
|
|
using Migrator.Framework;
|
|
|
|
namespace NzbDrone.Core.Datastore.Migrations
|
|
{
|
|
|
|
[Migration(20120220)]
|
|
public class Migration20120220 : NzbDroneMigration
|
|
{
|
|
protected override void MainDbUpgrade()
|
|
{
|
|
Database.AddTable("Seasons", new[]
|
|
{
|
|
new Column("SeasonId", DbType.Int32, ColumnProperty.PrimaryKeyWithIdentity),
|
|
new Column("SeriesId", DbType.Int32, ColumnProperty.NotNull),
|
|
new Column("SeasonNumber", DbType.Int32, ColumnProperty.NotNull),
|
|
new Column("Ignored", DbType.Boolean, ColumnProperty.NotNull)
|
|
});
|
|
|
|
Database.ExecuteNonQuery(@"INSERT INTO Seasons (SeriesId, SeasonNumber, Ignored)
|
|
SELECT SeriesId, SeasonNumber,
|
|
CASE WHEN Count(*) =
|
|
SUM(CASE WHEN Ignored = 1 THEN 1 ELSE 0 END) THEN 1 ELSE 0 END AS Ignored
|
|
FROM Episodes
|
|
GROUP BY SeriesId, SeasonNumber");
|
|
}
|
|
}
|
|
} |