Browse Source

move cleanup to new migration

pull/26/head
Jason Dove 6 years ago
parent
commit
3adeb04062
  1. 11
      ErsatzTV.Infrastructure/Migrations/20210220220723_ScheduleCollectionTypes.cs
  2. 1305
      ErsatzTV.Infrastructure/Migrations/20210221215810_RemoveScheduleItemsAndPosters.Designer.cs
  3. 25
      ErsatzTV.Infrastructure/Migrations/20210221215810_RemoveScheduleItemsAndPosters.cs

11
ErsatzTV.Infrastructure/Migrations/20210220220723_ScheduleCollectionTypes.cs

@ -112,17 +112,6 @@ namespace ErsatzTV.Infrastructure.Migrations
"TelevisionShows", "TelevisionShows",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Restrict); 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) protected override void Down(MigrationBuilder migrationBuilder)

1305
ErsatzTV.Infrastructure/Migrations/20210221215810_RemoveScheduleItemsAndPosters.Designer.cs generated

File diff suppressed because it is too large Load Diff

25
ErsatzTV.Infrastructure/Migrations/20210221215810_RemoveScheduleItemsAndPosters.cs

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ErsatzTV.Infrastructure.Migrations
{
public partial class RemoveScheduleItemsAndPosters : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
// 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)
{
}
}
}
Loading…
Cancel
Save