From 3c25b1a9bba6affac145ab50c15c507ff00da0d7 Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Sun, 21 Feb 2021 15:55:19 -0600 Subject: [PATCH] delete schedules that use legacy collections, reset all posters --- .../20210220220723_ScheduleCollectionTypes.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ErsatzTV.Infrastructure/Migrations/20210220220723_ScheduleCollectionTypes.cs b/ErsatzTV.Infrastructure/Migrations/20210220220723_ScheduleCollectionTypes.cs index 22c5aabe8..c3fb472a6 100644 --- a/ErsatzTV.Infrastructure/Migrations/20210220220723_ScheduleCollectionTypes.cs +++ b/ErsatzTV.Infrastructure/Migrations/20210220220723_ScheduleCollectionTypes.cs @@ -112,6 +112,17 @@ namespace ErsatzTV.Infrastructure.Migrations "TelevisionShows", principalColumn: "Id", onDelete: ReferentialAction.Restrict); + + // delete program schedule items that referenced television collections (that no longer exist) + migrationBuilder.Sql( + "delete from ProgramScheduleItems where MediaCollectionId not in (select Id from SimpleMediaCollections)"); + + // delete television collections that no longer exist/work + migrationBuilder.Sql( + "delete from MediaCollections where Id not in (select Id from SimpleMediaCollections)"); + + // delete all posters so they are all re-cached with a higher resolution + migrationBuilder.Sql("update MediaItems set Poster = null"); } protected override void Down(MigrationBuilder migrationBuilder)