Database redesign (#31)
* starting database redesign * set season and episode numbers * use datetimes in db (utc); update movie metadata * get movie cards from new table * copy show/episode metadata * remove old movie metadata type * rename new movie metadata type * code cleanup * start to remove old television classes * remove old television tables from database * fix playout building * fix collection views * fix show/season views * clean up movie metadata table * fix scanner tests * add libraries ui * code cleanup * fix movie scanning/metadata * add library scan button to ui * delete library path from ui * temp disable movie scanning * remove orphan media items and prevent duplicate paths * attach artwork to metadata * fix split show/season display * fix television artwork * store year distinct from release date * fix collections ui * code cleanup * add library paths from ui * fix adding to collections from ui * fix schedule items loading * schedule editing works again * remove some todos * more cleanup * fix unit tests * fix episode sorting * fix deleting show library paths * remove unused class * fix playout list in ui * fix log viewer * start to use version/file instead of statistics * clean up old columns * fix playout display (time zone) * fix playback * fix channel guide time zone * cascade more deletes * fix compiler warnings * fix adding new seasons * use artwork for channel logo * clean cache folder on startup (move channel logos, delete everything else) * log database migration * update homepage docs for libraries * fix adding new channel with logo * fix episode numbers in epg
This commit is contained in:
+1402
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,574 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class LibraryRework : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// create local media source to attach all paths to
|
||||
migrationBuilder.Sql("INSERT INTO MediaSources (SourceType) Values (99)");
|
||||
migrationBuilder.Sql("INSERT INTO LocalMediaSources (Id, MediaType) Values (last_insert_rowid(), 99)");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Library",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>("TEXT", nullable: true),
|
||||
MediaKind = table.Column<int>("INTEGER", nullable: false),
|
||||
LastScan = table.Column<DateTimeOffset>("TEXT", nullable: true),
|
||||
MediaSourceId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Library", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_Library_MediaSources_MediaSourceId",
|
||||
x => x.MediaSourceId,
|
||||
"MediaSources",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"LocalLibrary",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LocalLibrary", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_LocalLibrary_Library_Id",
|
||||
x => x.Id,
|
||||
"Library",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
// create local movies library
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO Library (Name, MediaKind, MediaSourceId)
|
||||
SELECT 'Movies', 1, Id FROM LocalMediaSources WHERE MediaType = 99");
|
||||
migrationBuilder.Sql("INSERT INTO LocalLibrary (Id) Values (last_insert_rowid())");
|
||||
|
||||
// create local shows library
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO Library (Name, MediaKind, MediaSourceId)
|
||||
SELECT 'Shows', 2, Id FROM LocalMediaSources WHERE MediaType = 99");
|
||||
migrationBuilder.Sql("INSERT INTO LocalLibrary (Id) Values (last_insert_rowid())");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"LibraryPath",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Path = table.Column<string>("TEXT", nullable: true),
|
||||
LibraryId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LibraryPath", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_LibraryPath_Library_LibraryId",
|
||||
x => x.LibraryId,
|
||||
"Library",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
// migrate movie source/folders to library paths
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO LibraryPath (Path, LibraryId)
|
||||
SELECT lms.Folder, l.Id
|
||||
FROM LocalMediaSources lms
|
||||
LEFT OUTER JOIN Library l ON l.MediaKind = 1
|
||||
WHERE lms.MediaType = 2");
|
||||
|
||||
// migrate show source/folders to library paths
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO LibraryPath (Path, LibraryId)
|
||||
SELECT lms.Folder, l.Id
|
||||
FROM LocalMediaSources lms
|
||||
LEFT OUTER JOIN Library l ON l.MediaKind = 2
|
||||
WHERE lms.MediaType = 1");
|
||||
|
||||
// migrate media item links
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"LibraryPathId",
|
||||
"MediaItems",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE MediaItems SET LibraryPathId =
|
||||
(SELECT l.Id FROM LibraryPath l INNER JOIN LocalMediaSources lms ON lms.Folder = l.Path WHERE lms.Id = MediaItems.MediaSourceId)");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"MediaSourceId",
|
||||
"MediaItems");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_MediaItems_MediaSourceId",
|
||||
"MediaItems");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_MediaItems_MediaSources_MediaSourceId",
|
||||
"MediaItems");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaItems_LibraryPathId",
|
||||
"MediaItems",
|
||||
"LibraryPathId");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_LocalMediaSources_MediaSources_Id",
|
||||
"LocalMediaSources");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlexMediaSources_MediaSources_Id",
|
||||
"PlexMediaSources");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_TelevisionShowSource_LocalMediaSources_MediaSourceId",
|
||||
"TelevisionShowSource");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"PlexMediaSourceConnections");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"PlexMediaSourceLibraries");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_MediaSources_Name",
|
||||
"MediaSources");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
"PK_PlexMediaSources",
|
||||
"PlexMediaSources");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
"PK_LocalMediaSources",
|
||||
"LocalMediaSources");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"LastScan",
|
||||
"MediaSources");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Name",
|
||||
"MediaSources");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"SourceType",
|
||||
"MediaSources");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Folder",
|
||||
"LocalMediaSources");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"MediaType",
|
||||
"LocalMediaSources");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
"PlexMediaSources",
|
||||
newName: "PlexMediaSource");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
"LocalMediaSources",
|
||||
newName: "LocalMediaSource");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"MovieId1",
|
||||
"MovieMetadata",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"ServerName",
|
||||
"PlexMediaSource",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
"PK_PlexMediaSource",
|
||||
"PlexMediaSource",
|
||||
"Id");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
"PK_LocalMediaSource",
|
||||
"LocalMediaSource",
|
||||
"Id");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"PlexConnection",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
IsActive = table.Column<bool>("INTEGER", nullable: false),
|
||||
Uri = table.Column<string>("TEXT", nullable: true),
|
||||
PlexMediaSourceId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexConnection", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_PlexConnection_PlexMediaSource_PlexMediaSourceId",
|
||||
x => x.PlexMediaSourceId,
|
||||
"PlexMediaSource",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"PlexMediaItemPart",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
PlexId = table.Column<int>("INTEGER", nullable: false),
|
||||
Key = table.Column<string>("TEXT", nullable: true),
|
||||
Duration = table.Column<int>("INTEGER", nullable: false),
|
||||
File = table.Column<string>("TEXT", nullable: true),
|
||||
Size = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_PlexMediaItemPart", x => x.Id); });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"PlexLibrary",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Key = table.Column<string>("TEXT", nullable: true),
|
||||
ShouldSyncItems = table.Column<bool>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexLibrary", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_PlexLibrary_Library_Id",
|
||||
x => x.Id,
|
||||
"Library",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"PlexMovies",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Key = table.Column<string>("TEXT", nullable: true),
|
||||
PartId = table.Column<int>("INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexMovies", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_PlexMovies_Movies_Id",
|
||||
x => x.Id,
|
||||
"Movies",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_PlexMovies_PlexMediaItemPart_PartId",
|
||||
x => x.PartId,
|
||||
"PlexMediaItemPart",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MovieMetadata_MovieId1",
|
||||
"MovieMetadata",
|
||||
"MovieId1");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Library_MediaSourceId",
|
||||
"Library",
|
||||
"MediaSourceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_LibraryPath_LibraryId",
|
||||
"LibraryPath",
|
||||
"LibraryId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_PlexConnection_PlexMediaSourceId",
|
||||
"PlexConnection",
|
||||
"PlexMediaSourceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_PlexMovies_PartId",
|
||||
"PlexMovies",
|
||||
"PartId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_LocalMediaSource_MediaSources_Id",
|
||||
"LocalMediaSource",
|
||||
"Id",
|
||||
"MediaSources",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_MediaItems_LibraryPath_LibraryPathId",
|
||||
"MediaItems",
|
||||
"LibraryPathId",
|
||||
"LibraryPath",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_MovieMetadata_Movies_MovieId1",
|
||||
"MovieMetadata",
|
||||
"MovieId1",
|
||||
"Movies",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlexMediaSource_MediaSources_Id",
|
||||
"PlexMediaSource",
|
||||
"Id",
|
||||
"MediaSources",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_TelevisionShowSource_LocalMediaSource_MediaSourceId",
|
||||
"TelevisionShowSource",
|
||||
"MediaSourceId",
|
||||
"LocalMediaSource",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_LocalMediaSource_MediaSources_Id",
|
||||
"LocalMediaSource");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_MediaItems_LibraryPath_LibraryPathId",
|
||||
"MediaItems");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_MovieMetadata_Movies_MovieId1",
|
||||
"MovieMetadata");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlexMediaSource_MediaSources_Id",
|
||||
"PlexMediaSource");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_TelevisionShowSource_LocalMediaSource_MediaSourceId",
|
||||
"TelevisionShowSource");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"LibraryPath");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"LocalLibrary");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"PlexConnection");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"PlexLibrary");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"PlexMovies");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Library");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"PlexMediaItemPart");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_MovieMetadata_MovieId1",
|
||||
"MovieMetadata");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
"PK_PlexMediaSource",
|
||||
"PlexMediaSource");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
"PK_LocalMediaSource",
|
||||
"LocalMediaSource");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"MovieId1",
|
||||
"MovieMetadata");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"ServerName",
|
||||
"PlexMediaSource");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
"PlexMediaSource",
|
||||
newName: "PlexMediaSources");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
"LocalMediaSource",
|
||||
newName: "LocalMediaSources");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
"LibraryPathId",
|
||||
"MediaItems",
|
||||
"MediaSourceId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
"IX_MediaItems_LibraryPathId",
|
||||
table: "MediaItems",
|
||||
newName: "IX_MediaItems_MediaSourceId");
|
||||
|
||||
migrationBuilder.AddColumn<DateTimeOffset>(
|
||||
"LastScan",
|
||||
"MediaSources",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Name",
|
||||
"MediaSources",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"SourceType",
|
||||
"MediaSources",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Folder",
|
||||
"LocalMediaSources",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"MediaType",
|
||||
"LocalMediaSources",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
"PK_PlexMediaSources",
|
||||
"PlexMediaSources",
|
||||
"Id");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
"PK_LocalMediaSources",
|
||||
"LocalMediaSources",
|
||||
"Id");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"PlexMediaSourceConnections",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
IsActive = table.Column<bool>("INTEGER", nullable: false),
|
||||
PlexMediaSourceId = table.Column<int>("INTEGER", nullable: true),
|
||||
Uri = table.Column<string>("TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexMediaSourceConnections", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_PlexMediaSourceConnections_PlexMediaSources_PlexMediaSourceId",
|
||||
x => x.PlexMediaSourceId,
|
||||
"PlexMediaSources",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"PlexMediaSourceLibraries",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Key = table.Column<string>("TEXT", nullable: true),
|
||||
MediaType = table.Column<int>("INTEGER", nullable: false),
|
||||
Name = table.Column<string>("TEXT", nullable: true),
|
||||
PlexMediaSourceId = table.Column<int>("INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlexMediaSourceLibraries", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_PlexMediaSourceLibraries_PlexMediaSources_PlexMediaSourceId",
|
||||
x => x.PlexMediaSourceId,
|
||||
"PlexMediaSources",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaSources_Name",
|
||||
"MediaSources",
|
||||
"Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_PlexMediaSourceConnections_PlexMediaSourceId",
|
||||
"PlexMediaSourceConnections",
|
||||
"PlexMediaSourceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_PlexMediaSourceLibraries_PlexMediaSourceId",
|
||||
"PlexMediaSourceLibraries",
|
||||
"PlexMediaSourceId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_LocalMediaSources_MediaSources_Id",
|
||||
"LocalMediaSources",
|
||||
"Id",
|
||||
"MediaSources",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_MediaItems_MediaSources_MediaSourceId",
|
||||
"MediaItems",
|
||||
"MediaSourceId",
|
||||
"MediaSources",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlexMediaSources_MediaSources_Id",
|
||||
"PlexMediaSources",
|
||||
"Id",
|
||||
"MediaSources",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_TelevisionShowSource_LocalMediaSources_MediaSourceId",
|
||||
"TelevisionShowSource",
|
||||
"MediaSourceId",
|
||||
"LocalMediaSources",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1402
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class RemoveOldMediaSources : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
// remove old source/folders
|
||||
migrationBuilder.Sql(@"DELETE FROM MediaSources WHERE Id NOT IN (SELECT MediaSourceId FROM Library)");
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1393
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1544
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,257 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class TelevisionMediaItems : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"TelevisionEpisodeId",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"TelevisionSeasonId",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"TelevisionShowId",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Collection",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>("TEXT", nullable: true)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_Collection", x => x.Id); });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Show",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Show", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_Show_MediaItem_Id",
|
||||
x => x.Id,
|
||||
"MediaItem",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"CollectionItem",
|
||||
table => new
|
||||
{
|
||||
CollectionId = table.Column<int>("INTEGER", nullable: false),
|
||||
MediaItemId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CollectionItem", x => new { x.CollectionId, x.MediaItemId });
|
||||
table.ForeignKey(
|
||||
"FK_CollectionItem_Collection_CollectionId",
|
||||
x => x.CollectionId,
|
||||
"Collection",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_CollectionItem_MediaItem_MediaItemId",
|
||||
x => x.MediaItemId,
|
||||
"MediaItem",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Season",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ShowId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Season", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_Season_MediaItem_Id",
|
||||
x => x.Id,
|
||||
"MediaItem",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_Season_Show_ShowId",
|
||||
x => x.ShowId,
|
||||
"Show",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Episode",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
SeasonId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Episode", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_Episode_MediaItem_Id",
|
||||
x => x.Id,
|
||||
"MediaItem",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_Episode_Season_SeasonId",
|
||||
x => x.SeasonId,
|
||||
"Season",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_CollectionItem_MediaItemId",
|
||||
"CollectionItem",
|
||||
"MediaItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Episode_SeasonId",
|
||||
"Episode",
|
||||
"SeasonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Season_ShowId",
|
||||
"Season",
|
||||
"ShowId");
|
||||
|
||||
// create show media items
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO MediaItem (TelevisionShowId, LibraryPathId)
|
||||
SELECT distinct ts.Id, mi.LibraryPathId
|
||||
FROM TelevisionShow ts
|
||||
INNER JOIN TelevisionSeason tsn ON tsn.TelevisionShowId = ts.Id
|
||||
INNER JOIN TelevisionEpisode te ON te.SeasonId = tsn.Id
|
||||
INNER JOIN MediaItem mi on mi.Id = te.Id");
|
||||
|
||||
// create shows
|
||||
migrationBuilder.Sql(@"INSERT INTO Show (Id) SELECT Id FROM MediaItem WHERE TelevisionShowId > 0");
|
||||
|
||||
// create season media items
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO MediaItem (TelevisionSeasonId, LibraryPathId)
|
||||
SELECT distinct tsn.Id, mi.LibraryPathId
|
||||
FROM TelevisionSeason tsn
|
||||
INNER JOIN TelevisionEpisode te ON te.SeasonId = tsn.Id
|
||||
INNER JOIN MediaItem mi on mi.Id = te.Id");
|
||||
|
||||
// create seasons
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO Season (Id, ShowId)
|
||||
SELECT mi.Id, mi2.Id
|
||||
FROM MediaItem mi
|
||||
INNER JOIN TelevisionSeason tsn ON tsn.Id = mi.TelevisionSeasonId
|
||||
INNER JOIN MediaItem mi2 ON mi2.TelevisionShowId = tsn.TelevisionShowId AND mi.LibraryPathId = mi2.LibraryPathId");
|
||||
|
||||
// mark episode media items
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE MediaItem SET TelevisionEpisodeId = Id
|
||||
WHERE Id IN (SELECT Id FROM TelevisionEpisode)");
|
||||
|
||||
// create episodes
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO Episode (Id, SeasonId)
|
||||
SELECT mi.Id, mi2.Id
|
||||
FROM MediaItem mi
|
||||
INNER JOIN TelevisionEpisode te on mi.Id = te.Id
|
||||
INNER JOIN MediaItem mi2 ON mi2.TelevisionSeasonId = te.SeasonId AND mi.LibraryPathId = mi2.LibraryPathId");
|
||||
|
||||
// collections
|
||||
migrationBuilder.Sql(@"INSERT INTO Collection (Name) SELECT Name FROM MediaCollection");
|
||||
|
||||
// collection movies
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO CollectionItem (CollectionId, MediaItemId)
|
||||
SELECT c.Id, smcm.MoviesId
|
||||
FROM Collection c
|
||||
INNER JOIN MediaCollection mc on mc.Name = c.Name
|
||||
INNER JOIN SimpleMediaCollectionMovie smcm ON smcm.SimpleMediaCollectionsId = mc.Id");
|
||||
|
||||
// collection shows
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO CollectionItem (CollectionId, MediaItemId)
|
||||
SELECT c.Id, mi.Id
|
||||
FROM Collection c
|
||||
INNER JOIN MediaCollection mc on mc.Name = c.Name
|
||||
INNER JOIN SimpleMediaCollectionShow smcs ON smcs.SimpleMediaCollectionsId = mc.Id
|
||||
INNER JOIN MediaItem mi ON mi.TelevisionShowId = smcs.TelevisionShowsId");
|
||||
|
||||
// collection seasons
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO CollectionItem (CollectionId, MediaItemId)
|
||||
SELECT c.Id, mi.Id
|
||||
FROM Collection c
|
||||
INNER JOIN MediaCollection mc on mc.Name = c.Name
|
||||
INNER JOIN SimpleMediaCollectionSeason smcs ON smcs.SimpleMediaCollectionsId = mc.Id
|
||||
INNER JOIN MediaItem mi ON mi.TelevisionSeasonId = smcs.TelevisionSeasonsId");
|
||||
|
||||
// collection episodes
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO CollectionItem (CollectionId, MediaItemId)
|
||||
SELECT c.Id, mi.Id
|
||||
FROM Collection c
|
||||
INNER JOIN MediaCollection mc on mc.Name = c.Name
|
||||
INNER JOIN SimpleMediaCollectionEpisode smce ON smce.SimpleMediaCollectionsId = mc.Id
|
||||
INNER JOIN MediaItem mi ON mi.TelevisionEpisodeId = smce.TelevisionEpisodesId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
"CollectionItem");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Episode");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Collection");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Season");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"Show");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"TelevisionEpisodeId",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"TelevisionSeasonId",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"TelevisionShowId",
|
||||
"MediaItem");
|
||||
}
|
||||
}
|
||||
}
|
||||
ErsatzTV.Infrastructure/Migrations/20210226110438_ProgramSchedule_CollectionAndMediaItem.Designer.cs
Generated
+1588
File diff suppressed because it is too large
Load Diff
+137
@@ -0,0 +1,137 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class ProgramSchedule_CollectionAndMediaItem : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"CollectionId",
|
||||
"ProgramScheduleItem",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"MediaItemId",
|
||||
"ProgramScheduleItem",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_ProgramScheduleItem_CollectionId",
|
||||
"ProgramScheduleItem",
|
||||
"CollectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_ProgramScheduleItem_MediaItemId",
|
||||
"ProgramScheduleItem",
|
||||
"MediaItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_PlayoutProgramScheduleAnchor_MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"MediaItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_PlayoutProgramScheduleAnchor_NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"NewCollectionId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"NewCollectionId",
|
||||
"Collection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_MediaItem_MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"MediaItemId",
|
||||
"MediaItem",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_Collection_CollectionId",
|
||||
"ProgramScheduleItem",
|
||||
"CollectionId",
|
||||
"Collection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_MediaItem_MediaItemId",
|
||||
"ProgramScheduleItem",
|
||||
"MediaItemId",
|
||||
"MediaItem",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_MediaItem_MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_Collection_CollectionId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_MediaItem_MediaItemId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_ProgramScheduleItem_CollectionId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_ProgramScheduleItem_MediaItemId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_PlayoutProgramScheduleAnchor_MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_PlayoutProgramScheduleAnchor_NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"CollectionId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"MediaItemId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1588
File diff suppressed because it is too large
Load Diff
+50
@@ -0,0 +1,50 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class ProgramSchedule_UpdateCollectionAndMediaItem : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// update schedule items that reference collections
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE ProgramScheduleItem SET CollectionId =
|
||||
(SELECT c.Id FROM Collection c INNER JOIN MediaCollection mc ON mc.Name = c.Name WHERE mc.Id = MediaCollectionId)
|
||||
WHERE MediaCollectionId > 0");
|
||||
|
||||
// update schedule items that reference shows
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE ProgramScheduleItem SET MediaItemId =
|
||||
(SELECT mi.Id FROM MediaItem mi WHERE mi.TelevisionShowId = ProgramScheduleItem.TelevisionShowId)
|
||||
WHERE TelevisionShowId > 0");
|
||||
|
||||
// update schedule items that reference seasons
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE ProgramScheduleItem SET MediaItemId =
|
||||
(SELECT mi.Id FROM MediaItem mi WHERE mi.TelevisionSeasonId = ProgramScheduleItem.TelevisionSeasonId)
|
||||
WHERE TelevisionSeasonId > 0");
|
||||
|
||||
// update anchors that reference collections
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE PlayoutProgramScheduleAnchor SET NewCollectionId =
|
||||
(SELECT c.Id FROM Collection c INNER JOIN MediaCollection mc on c.Name = mc.Name WHERE mc.Id = CollectionId)
|
||||
WHERE CollectionType = 0");
|
||||
|
||||
// update anchors that reference shows
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE PlayoutProgramScheduleAnchor SET MediaItemId =
|
||||
(SELECT mi.Id from MediaItem mi WHERE mi.TelevisionShowId = CollectionId)
|
||||
WHERE CollectionType = 1");
|
||||
|
||||
// update anchors that reference seasons
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE PlayoutProgramScheduleAnchor SET MediaItemId =
|
||||
(SELECT mi.Id FROM MediaItem mi WHERE mi.TelevisionSeasonId = CollectionId)
|
||||
WHERE CollectionType = 2");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1874
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_VersionsAndMetadata : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"SeasonNumber",
|
||||
"Season",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"EpisodeNumber",
|
||||
"Episode",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"EpisodeMetadata",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Outline = table.Column<string>("TEXT", nullable: true),
|
||||
Plot = table.Column<string>("TEXT", nullable: true),
|
||||
Tagline = table.Column<string>("TEXT", nullable: true),
|
||||
EpisodeId = table.Column<int>("INTEGER", nullable: false),
|
||||
MetadataKind = table.Column<int>("INTEGER", nullable: false),
|
||||
Title = table.Column<string>("TEXT", nullable: true),
|
||||
OriginalTitle = table.Column<string>("TEXT", nullable: true),
|
||||
SortTitle = table.Column<string>("TEXT", nullable: true),
|
||||
ReleaseDate = table.Column<DateTimeOffset>("TEXT", nullable: true),
|
||||
DateAdded = table.Column<DateTimeOffset>("TEXT", nullable: false),
|
||||
DateUpdated = table.Column<DateTimeOffset>("TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EpisodeMetadata", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_EpisodeMetadata_Episode_EpisodeId",
|
||||
x => x.EpisodeId,
|
||||
"Episode",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"MediaVersion",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>("TEXT", nullable: true),
|
||||
Duration = table.Column<TimeSpan>("TEXT", nullable: false),
|
||||
SampleAspectRatio = table.Column<string>("TEXT", nullable: true),
|
||||
DisplayAspectRatio = table.Column<string>("TEXT", nullable: true),
|
||||
VideoCodec = table.Column<string>("TEXT", nullable: true),
|
||||
AudioCodec = table.Column<string>("TEXT", nullable: true),
|
||||
IsInterlaced = table.Column<bool>("INTEGER", nullable: false),
|
||||
Width = table.Column<int>("INTEGER", nullable: false),
|
||||
Height = table.Column<int>("INTEGER", nullable: false),
|
||||
EpisodeId = table.Column<int>("INTEGER", nullable: true),
|
||||
MovieId = table.Column<int>("INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaVersion", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_MediaVersion_Episode_EpisodeId",
|
||||
x => x.EpisodeId,
|
||||
"Episode",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_MediaVersion_Movie_MovieId",
|
||||
x => x.MovieId,
|
||||
"Movie",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"NewMovieMetadata",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Outline = table.Column<string>("TEXT", nullable: true),
|
||||
Plot = table.Column<string>("TEXT", nullable: true),
|
||||
Tagline = table.Column<string>("TEXT", nullable: true),
|
||||
MovieId = table.Column<int>("INTEGER", nullable: false),
|
||||
MetadataKind = table.Column<int>("INTEGER", nullable: false),
|
||||
Title = table.Column<string>("TEXT", nullable: true),
|
||||
OriginalTitle = table.Column<string>("TEXT", nullable: true),
|
||||
SortTitle = table.Column<string>("TEXT", nullable: true),
|
||||
ReleaseDate = table.Column<DateTimeOffset>("TEXT", nullable: true),
|
||||
DateAdded = table.Column<DateTimeOffset>("TEXT", nullable: false),
|
||||
DateUpdated = table.Column<DateTimeOffset>("TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_NewMovieMetadata", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_NewMovieMetadata_Movie_MovieId",
|
||||
x => x.MovieId,
|
||||
"Movie",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"ShowMetadata",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Outline = table.Column<string>("TEXT", nullable: true),
|
||||
Plot = table.Column<string>("TEXT", nullable: true),
|
||||
Tagline = table.Column<string>("TEXT", nullable: true),
|
||||
ShowId = table.Column<int>("INTEGER", nullable: false),
|
||||
MetadataKind = table.Column<int>("INTEGER", nullable: false),
|
||||
Title = table.Column<string>("TEXT", nullable: true),
|
||||
OriginalTitle = table.Column<string>("TEXT", nullable: true),
|
||||
SortTitle = table.Column<string>("TEXT", nullable: true),
|
||||
ReleaseDate = table.Column<DateTimeOffset>("TEXT", nullable: true),
|
||||
DateAdded = table.Column<DateTimeOffset>("TEXT", nullable: false),
|
||||
DateUpdated = table.Column<DateTimeOffset>("TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShowMetadata", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_ShowMetadata_Show_ShowId",
|
||||
x => x.ShowId,
|
||||
"Show",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"MediaFile",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Path = table.Column<string>("TEXT", nullable: true),
|
||||
MediaVersionId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MediaFile", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_MediaFile_MediaVersion_MediaVersionId",
|
||||
x => x.MediaVersionId,
|
||||
"MediaVersion",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_EpisodeMetadata_EpisodeId",
|
||||
"EpisodeMetadata",
|
||||
"EpisodeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaFile_MediaVersionId",
|
||||
"MediaFile",
|
||||
"MediaVersionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaVersion_EpisodeId",
|
||||
"MediaVersion",
|
||||
"EpisodeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaVersion_MovieId",
|
||||
"MediaVersion",
|
||||
"MovieId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_NewMovieMetadata_MovieId",
|
||||
"NewMovieMetadata",
|
||||
"MovieId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_ShowMetadata_ShowId",
|
||||
"ShowMetadata",
|
||||
"ShowId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
"EpisodeMetadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"MediaFile");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"NewMovieMetadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"ShowMetadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"MediaVersion");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"SeasonNumber",
|
||||
"Season");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"EpisodeNumber",
|
||||
"Episode");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1874
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Update_SeasonAndEpisodeNumbers : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE Season SET SeasonNumber =
|
||||
(SELECT Number FROM TelevisionSeason ts INNER JOIN MediaItem mi on mi.Id = Season.Id AND mi.TelevisionSeasonId = ts.Id)
|
||||
WHERE SeasonNumber = 0");
|
||||
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE Episode SET EpisodeNumber =
|
||||
(SELECT Episode FROM TelevisionEpisodeMetadata tem INNER JOIN MediaItem mi ON mi.Id = Episode.Id AND mi.TelevisionEpisodeId = tem.TelevisionEpisodeId)
|
||||
WHERE EpisodeNumber = 0");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1874
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Update_MovieMetadata : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
var now = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.FFFFFFF");
|
||||
|
||||
migrationBuilder.Sql(
|
||||
@$"INSERT INTO NewMovieMetadata (Outline, Plot, Tagline, MovieId, MetadataKind, Title, OriginalTitle, SortTitle, ReleaseDate, DateAdded, DateUpdated)
|
||||
SELECT mm.Outline, mm.Plot, mm.Tagline, m.Id, mm.Source, mm.Title, null, mm.SortTitle, mm.Premiered, '{now}', mm.LastWriteTime
|
||||
FROM MovieMetadata mm
|
||||
INNER JOIN Movie m ON mm.MovieId = m.Id");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1874
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Update_TelevisionMetadata : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
var now = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.FFFFFFF");
|
||||
|
||||
migrationBuilder.Sql(
|
||||
$@"INSERT INTO ShowMetadata (Outline, Plot, Tagline, ShowId, MetadataKind, Title, OriginalTitle, SortTitle, ReleaseDate, DateAdded, DateUpdated)
|
||||
SELECT null, tsm.Plot, null, m.Id, tsm.Source, tsm.Title, null, tsm.SortTitle, tsm.Year || '-01-01 00:00:00', '{now}', '0001-01-01 00:00:00'
|
||||
FROM TelevisionShowMetadata tsm
|
||||
INNER JOIN MediaItem m ON tsm.TelevisionShowId = m.TelevisionShowId");
|
||||
|
||||
migrationBuilder.Sql(
|
||||
$@"INSERT INTO EpisodeMetadata (Outline, Plot, Tagline, EpisodeId, MetadataKind, Title, OriginalTitle, SortTitle, ReleaseDate, DateAdded, DateUpdated)
|
||||
SELECT null, tem.Plot, null, m.Id, tem.Source, tem.Title, null, tem.SortTitle, tem.Aired, '{now}', IFNULL(tem.LastWriteTime, '0001-01-01 00:00:00')
|
||||
FROM TelevisionEpisodeMetadata tem
|
||||
INNER JOIN MediaItem m ON tem.TelevisionEpisodeId = m.TelevisionEpisodeId;");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1811
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Remove_OldMovieMetadata : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
"MovieMetadata");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"MetadataId",
|
||||
"Movie");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"MetadataId",
|
||||
"Movie",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"MovieMetadata",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ContentRating = table.Column<string>("TEXT", nullable: true),
|
||||
LastWriteTime = table.Column<DateTime>("TEXT", nullable: true),
|
||||
MovieId = table.Column<int>("INTEGER", nullable: false),
|
||||
Outline = table.Column<string>("TEXT", nullable: true),
|
||||
Plot = table.Column<string>("TEXT", nullable: true),
|
||||
Premiered = table.Column<DateTime>("TEXT", nullable: true),
|
||||
SortTitle = table.Column<string>("TEXT", nullable: true),
|
||||
Source = table.Column<int>("INTEGER", nullable: false),
|
||||
Tagline = table.Column<string>("TEXT", nullable: true),
|
||||
Title = table.Column<string>("TEXT", nullable: true),
|
||||
Year = table.Column<int>("INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MovieMetadata", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_MovieMetadata_Movie_MovieId",
|
||||
x => x.MovieId,
|
||||
"Movie",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MovieMetadata_MovieId",
|
||||
"MovieMetadata",
|
||||
"MovieId",
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1361
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,489 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Remove_OldTelevisionEntities : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
@"UPDATE ProgramScheduleItem SET
|
||||
MediaCollectionId = null,
|
||||
TelevisionSeasonId = null,
|
||||
TelevisionShowId = null");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_MediaCollection_MediaCollectionId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_TelevisionSeason_TelevisionSeasonId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_TelevisionShow_TelevisionShowId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"SimpleMediaCollectionEpisode");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"SimpleMediaCollectionMovie");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"SimpleMediaCollectionSeason");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"SimpleMediaCollectionShow");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"TelevisionEpisodeMetadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"TelevisionShowMetadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"TelevisionShowSource");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"SimpleMediaCollection");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"TelevisionEpisode");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"MediaCollection");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"TelevisionSeason");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"TelevisionShow");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_ProgramScheduleItem_MediaCollectionId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_ProgramScheduleItem_TelevisionSeasonId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_ProgramScheduleItem_TelevisionShowId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"MediaCollectionId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"TelevisionSeasonId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"TelevisionShowId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"CollectionId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"MediaCollectionId",
|
||||
"ProgramScheduleItem",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"TelevisionSeasonId",
|
||||
"ProgramScheduleItem",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"TelevisionShowId",
|
||||
"ProgramScheduleItem",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"CollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"MediaCollection",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>("TEXT", nullable: true)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_MediaCollection", x => x.Id); });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"TelevisionShow",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Poster = table.Column<string>("TEXT", nullable: true),
|
||||
PosterLastWriteTime = table.Column<DateTime>("TEXT", nullable: true)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_TelevisionShow", x => x.Id); });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"SimpleMediaCollection",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SimpleMediaCollection", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollection_MediaCollection_Id",
|
||||
x => x.Id,
|
||||
"MediaCollection",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"TelevisionSeason",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Number = table.Column<int>("INTEGER", nullable: false),
|
||||
Path = table.Column<string>("TEXT", nullable: true),
|
||||
Poster = table.Column<string>("TEXT", nullable: true),
|
||||
PosterLastWriteTime = table.Column<DateTime>("TEXT", nullable: true),
|
||||
TelevisionShowId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TelevisionSeason", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_TelevisionSeason_TelevisionShow_TelevisionShowId",
|
||||
x => x.TelevisionShowId,
|
||||
"TelevisionShow",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"TelevisionShowMetadata",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
LastWriteTime = table.Column<DateTime>("TEXT", nullable: true),
|
||||
Plot = table.Column<string>("TEXT", nullable: true),
|
||||
SortTitle = table.Column<string>("TEXT", nullable: true),
|
||||
Source = table.Column<int>("INTEGER", nullable: false),
|
||||
TelevisionShowId = table.Column<int>("INTEGER", nullable: false),
|
||||
Title = table.Column<string>("TEXT", nullable: true),
|
||||
Year = table.Column<int>("INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TelevisionShowMetadata", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_TelevisionShowMetadata_TelevisionShow_TelevisionShowId",
|
||||
x => x.TelevisionShowId,
|
||||
"TelevisionShow",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"TelevisionShowSource",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Discriminator = table.Column<string>("TEXT", nullable: false),
|
||||
TelevisionShowId = table.Column<int>("INTEGER", nullable: false),
|
||||
MediaSourceId = table.Column<int>("INTEGER", nullable: true),
|
||||
Path = table.Column<string>("TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TelevisionShowSource", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_TelevisionShowSource_LocalMediaSource_MediaSourceId",
|
||||
x => x.MediaSourceId,
|
||||
"LocalMediaSource",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_TelevisionShowSource_TelevisionShow_TelevisionShowId",
|
||||
x => x.TelevisionShowId,
|
||||
"TelevisionShow",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"SimpleMediaCollectionMovie",
|
||||
table => new
|
||||
{
|
||||
MoviesId = table.Column<int>("INTEGER", nullable: false),
|
||||
SimpleMediaCollectionsId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey(
|
||||
"PK_SimpleMediaCollectionMovie",
|
||||
x => new { x.MoviesId, x.SimpleMediaCollectionsId });
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollectionMovie_Movie_MoviesId",
|
||||
x => x.MoviesId,
|
||||
"Movie",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollectionMovie_SimpleMediaCollection_SimpleMediaCollectionsId",
|
||||
x => x.SimpleMediaCollectionsId,
|
||||
"SimpleMediaCollection",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"SimpleMediaCollectionShow",
|
||||
table => new
|
||||
{
|
||||
SimpleMediaCollectionsId = table.Column<int>("INTEGER", nullable: false),
|
||||
TelevisionShowsId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey(
|
||||
"PK_SimpleMediaCollectionShow",
|
||||
x => new { x.SimpleMediaCollectionsId, x.TelevisionShowsId });
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollectionShow_SimpleMediaCollection_SimpleMediaCollectionsId",
|
||||
x => x.SimpleMediaCollectionsId,
|
||||
"SimpleMediaCollection",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollectionShow_TelevisionShow_TelevisionShowsId",
|
||||
x => x.TelevisionShowsId,
|
||||
"TelevisionShow",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"SimpleMediaCollectionSeason",
|
||||
table => new
|
||||
{
|
||||
SimpleMediaCollectionsId = table.Column<int>("INTEGER", nullable: false),
|
||||
TelevisionSeasonsId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey(
|
||||
"PK_SimpleMediaCollectionSeason",
|
||||
x => new { x.SimpleMediaCollectionsId, x.TelevisionSeasonsId });
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollectionSeason_SimpleMediaCollection_SimpleMediaCollectionsId",
|
||||
x => x.SimpleMediaCollectionsId,
|
||||
"SimpleMediaCollection",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollectionSeason_TelevisionSeason_TelevisionSeasonsId",
|
||||
x => x.TelevisionSeasonsId,
|
||||
"TelevisionSeason",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"TelevisionEpisode",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
SeasonId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TelevisionEpisode", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_TelevisionEpisode_MediaItem_Id",
|
||||
x => x.Id,
|
||||
"MediaItem",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_TelevisionEpisode_TelevisionSeason_SeasonId",
|
||||
x => x.SeasonId,
|
||||
"TelevisionSeason",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"SimpleMediaCollectionEpisode",
|
||||
table => new
|
||||
{
|
||||
SimpleMediaCollectionsId = table.Column<int>("INTEGER", nullable: false),
|
||||
TelevisionEpisodesId = table.Column<int>("INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey(
|
||||
"PK_SimpleMediaCollectionEpisode",
|
||||
x => new { x.SimpleMediaCollectionsId, x.TelevisionEpisodesId });
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollectionEpisode_SimpleMediaCollection_SimpleMediaCollectionsId",
|
||||
x => x.SimpleMediaCollectionsId,
|
||||
"SimpleMediaCollection",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_SimpleMediaCollectionEpisode_TelevisionEpisode_TelevisionEpisodesId",
|
||||
x => x.TelevisionEpisodesId,
|
||||
"TelevisionEpisode",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"TelevisionEpisodeMetadata",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Aired = table.Column<DateTime>("TEXT", nullable: true),
|
||||
Episode = table.Column<int>("INTEGER", nullable: false),
|
||||
LastWriteTime = table.Column<DateTime>("TEXT", nullable: true),
|
||||
Plot = table.Column<string>("TEXT", nullable: true),
|
||||
Season = table.Column<int>("INTEGER", nullable: false),
|
||||
SortTitle = table.Column<string>("TEXT", nullable: true),
|
||||
Source = table.Column<int>("INTEGER", nullable: false),
|
||||
TelevisionEpisodeId = table.Column<int>("INTEGER", nullable: false),
|
||||
Title = table.Column<string>("TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TelevisionEpisodeMetadata", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_TelevisionEpisodeMetadata_TelevisionEpisode_TelevisionEpisodeId",
|
||||
x => x.TelevisionEpisodeId,
|
||||
"TelevisionEpisode",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_ProgramScheduleItem_MediaCollectionId",
|
||||
"ProgramScheduleItem",
|
||||
"MediaCollectionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_ProgramScheduleItem_TelevisionSeasonId",
|
||||
"ProgramScheduleItem",
|
||||
"TelevisionSeasonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_ProgramScheduleItem_TelevisionShowId",
|
||||
"ProgramScheduleItem",
|
||||
"TelevisionShowId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaCollection_Name",
|
||||
"MediaCollection",
|
||||
"Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_SimpleMediaCollectionEpisode_TelevisionEpisodesId",
|
||||
"SimpleMediaCollectionEpisode",
|
||||
"TelevisionEpisodesId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_SimpleMediaCollectionMovie_SimpleMediaCollectionsId",
|
||||
"SimpleMediaCollectionMovie",
|
||||
"SimpleMediaCollectionsId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_SimpleMediaCollectionSeason_TelevisionSeasonsId",
|
||||
"SimpleMediaCollectionSeason",
|
||||
"TelevisionSeasonsId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_SimpleMediaCollectionShow_TelevisionShowsId",
|
||||
"SimpleMediaCollectionShow",
|
||||
"TelevisionShowsId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_TelevisionEpisode_SeasonId",
|
||||
"TelevisionEpisode",
|
||||
"SeasonId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_TelevisionEpisodeMetadata_TelevisionEpisodeId",
|
||||
"TelevisionEpisodeMetadata",
|
||||
"TelevisionEpisodeId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_TelevisionSeason_TelevisionShowId",
|
||||
"TelevisionSeason",
|
||||
"TelevisionShowId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_TelevisionShowMetadata_TelevisionShowId",
|
||||
"TelevisionShowMetadata",
|
||||
"TelevisionShowId",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_TelevisionShowSource_MediaSourceId",
|
||||
"TelevisionShowSource",
|
||||
"MediaSourceId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_TelevisionShowSource_TelevisionShowId",
|
||||
"TelevisionShowSource",
|
||||
"TelevisionShowId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_MediaCollection_MediaCollectionId",
|
||||
"ProgramScheduleItem",
|
||||
"MediaCollectionId",
|
||||
"MediaCollection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_TelevisionSeason_TelevisionSeasonId",
|
||||
"ProgramScheduleItem",
|
||||
"TelevisionSeasonId",
|
||||
"TelevisionSeason",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_TelevisionShow_TelevisionShowId",
|
||||
"ProgramScheduleItem",
|
||||
"TelevisionShowId",
|
||||
"TelevisionShow",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1361
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class CleanUp_MovieMetadata : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_NewMovieMetadata_Movie_MovieId",
|
||||
"NewMovieMetadata");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
"PK_NewMovieMetadata",
|
||||
"NewMovieMetadata");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
"NewMovieMetadata",
|
||||
newName: "MovieMetadata");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
"NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"CollectionId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
"IX_PlayoutProgramScheduleAnchor_NewCollectionId",
|
||||
table: "PlayoutProgramScheduleAnchor",
|
||||
newName: "IX_PlayoutProgramScheduleAnchor_CollectionId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
"IX_NewMovieMetadata_MovieId",
|
||||
table: "MovieMetadata",
|
||||
newName: "IX_MovieMetadata_MovieId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
"PK_MovieMetadata",
|
||||
"MovieMetadata",
|
||||
"Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_MovieMetadata_Movie_MovieId",
|
||||
"MovieMetadata",
|
||||
"MovieId",
|
||||
"Movie",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_CollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"CollectionId",
|
||||
"Collection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_MovieMetadata_Movie_MovieId",
|
||||
"MovieMetadata");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_CollectionId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
"PK_MovieMetadata",
|
||||
"MovieMetadata");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
"MovieMetadata",
|
||||
newName: "NewMovieMetadata");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
"CollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"NewCollectionId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
"IX_PlayoutProgramScheduleAnchor_CollectionId",
|
||||
table: "PlayoutProgramScheduleAnchor",
|
||||
newName: "IX_PlayoutProgramScheduleAnchor_NewCollectionId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
"IX_MovieMetadata_MovieId",
|
||||
table: "NewMovieMetadata",
|
||||
newName: "IX_NewMovieMetadata_MovieId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
"PK_NewMovieMetadata",
|
||||
"NewMovieMetadata",
|
||||
"Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_NewMovieMetadata_Movie_MovieId",
|
||||
"NewMovieMetadata",
|
||||
"MovieId",
|
||||
"Movie",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_NewCollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"NewCollectionId",
|
||||
"Collection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1364
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_MediaItemPathIndex : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// delete orphan movies, if any exist
|
||||
migrationBuilder.Sql(
|
||||
@"DELETE FROM MediaItem WHERE Id IN
|
||||
(SELECT mi.Id FROM Library l
|
||||
INNER JOIN LibraryPath lp ON l.Id = lp.LibraryId
|
||||
INNER JOIN MediaItem mi ON lp.Id = mi.LibraryPathId
|
||||
LEFT OUTER JOIN Movie m ON mi.Id = m.Id
|
||||
WHERE l.MediaKind = 1 AND m.Id IS NULL)");
|
||||
|
||||
// delete orphan episodes, if any exist
|
||||
migrationBuilder.Sql(
|
||||
@"DELETE FROM MediaItem WHERE Id IN
|
||||
(SELECT mi.Id FROM Library l
|
||||
INNER JOIN LibraryPath lp ON l.Id = lp.LibraryId
|
||||
INNER JOIN MediaItem mi ON lp.Id = mi.LibraryPathId
|
||||
LEFT OUTER JOIN Show s ON mi.Id = s.Id
|
||||
LEFT OUTER JOIN Season ssn ON mi.Id = ssn.Id
|
||||
LEFT OUTER JOIN Episode e ON mi.Id = e.Id
|
||||
WHERE l.MediaKind = 2 AND s.Id IS NULL AND ssn.Id IS NULL AND e.Id IS NULL)");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaItem_Path",
|
||||
"MediaItem",
|
||||
"Path",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_MediaItem_Path",
|
||||
"MediaItem");
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_Artwork : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
"Poster",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"PosterLastWriteTime",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"Artwork",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Path = table.Column<string>("TEXT", nullable: true),
|
||||
ArtworkKind = table.Column<int>("INTEGER", nullable: false),
|
||||
DateAdded = table.Column<DateTime>("TEXT", nullable: false),
|
||||
DateUpdated = table.Column<DateTime>("TEXT", nullable: false),
|
||||
EpisodeMetadataId = table.Column<int>("INTEGER", nullable: true),
|
||||
MovieMetadataId = table.Column<int>("INTEGER", nullable: true),
|
||||
ShowMetadataId = table.Column<int>("INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Artwork", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_Artwork_EpisodeMetadata_EpisodeMetadataId",
|
||||
x => x.EpisodeMetadataId,
|
||||
"EpisodeMetadata",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_Artwork_MovieMetadata_MovieMetadataId",
|
||||
x => x.MovieMetadataId,
|
||||
"MovieMetadata",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
"FK_Artwork_ShowMetadata_ShowMetadataId",
|
||||
x => x.ShowMetadataId,
|
||||
"ShowMetadata",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Artwork_EpisodeMetadataId",
|
||||
"Artwork",
|
||||
"EpisodeMetadataId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Artwork_MovieMetadataId",
|
||||
"Artwork",
|
||||
"MovieMetadataId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Artwork_ShowMetadataId",
|
||||
"Artwork",
|
||||
"ShowMetadataId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
"Artwork");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Poster",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
"PosterLastWriteTime",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1496
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_SeasonMetadata : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"SeasonMetadataId",
|
||||
"Artwork",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
"SeasonMetadata",
|
||||
table => new
|
||||
{
|
||||
Id = table.Column<int>("INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Outline = table.Column<string>("TEXT", nullable: true),
|
||||
SeasonId = table.Column<int>("INTEGER", nullable: false),
|
||||
MetadataKind = table.Column<int>("INTEGER", nullable: false),
|
||||
Title = table.Column<string>("TEXT", nullable: true),
|
||||
OriginalTitle = table.Column<string>("TEXT", nullable: true),
|
||||
SortTitle = table.Column<string>("TEXT", nullable: true),
|
||||
ReleaseDate = table.Column<DateTime>("TEXT", nullable: true),
|
||||
DateAdded = table.Column<DateTime>("TEXT", nullable: false),
|
||||
DateUpdated = table.Column<DateTime>("TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SeasonMetadata", x => x.Id);
|
||||
table.ForeignKey(
|
||||
"FK_SeasonMetadata_Season_SeasonId",
|
||||
x => x.SeasonId,
|
||||
"Season",
|
||||
"Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Artwork_SeasonMetadataId",
|
||||
"Artwork",
|
||||
"SeasonMetadataId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_SeasonMetadata_SeasonId",
|
||||
"SeasonMetadata",
|
||||
"SeasonId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId",
|
||||
"Artwork",
|
||||
"SeasonMetadataId",
|
||||
"SeasonMetadata",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId",
|
||||
"Artwork");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
"SeasonMetadata");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_Artwork_SeasonMetadataId",
|
||||
"Artwork");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"SeasonMetadataId",
|
||||
"Artwork");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1508
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_MetadataYear : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"Year",
|
||||
"ShowMetadata",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"Year",
|
||||
"SeasonMetadata",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"Year",
|
||||
"MovieMetadata",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"Year",
|
||||
"EpisodeMetadata",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
"Year",
|
||||
"ShowMetadata");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Year",
|
||||
"SeasonMetadata");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Year",
|
||||
"MovieMetadata");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Year",
|
||||
"EpisodeMetadata");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1508
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Reset_MetadataDateUpdated : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"UPDATE MovieMetadata SET DateUpdated = '0001-01-01 00:00:00'");
|
||||
migrationBuilder.Sql(@"UPDATE ShowMetadata SET Year = substr(ReleaseDate, 1, 4)");
|
||||
migrationBuilder.Sql(@"UPDATE SeasonMetadata SET DateUpdated = '0001-01-01 00:00:00'");
|
||||
migrationBuilder.Sql(@"UPDATE EpisodeMetadata SET DateUpdated = '0001-01-01 00:00:00'");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1509
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_SeasonMetadataCascade : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId",
|
||||
"Artwork");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId",
|
||||
"Artwork",
|
||||
"SeasonMetadataId",
|
||||
"SeasonMetadata",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId",
|
||||
"Artwork");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_Artwork_SeasonMetadata_SeasonMetadataId",
|
||||
"Artwork",
|
||||
"SeasonMetadataId",
|
||||
"SeasonMetadata",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1509
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_MediaVersionVideoScanKind : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.RenameColumn(
|
||||
"IsInterlaced",
|
||||
"MediaVersion",
|
||||
"VideoScanKind");
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.RenameColumn(
|
||||
"VideoScanKind",
|
||||
"MediaVersion",
|
||||
"IsInterlaced");
|
||||
}
|
||||
}
|
||||
+1509
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Update_MediaVersion : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
// movie versions
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO MediaVersion (Name, Duration, SampleAspectRatio, DisplayAspectRatio, VideoCodec, AudioCodec, VideoScanKind, Width, Height, EpisodeId, MovieId)
|
||||
SELECT 'Main', mi.Statistics_Duration, mi.Statistics_SampleAspectRatio, mi.Statistics_DisplayAspectRatio, mi.Statistics_VideoCodec, mi.Statistics_AudioCodec, mi.Statistics_VideoScanType, mi.Statistics_Width, mi.Statistics_Height, null, m.Id
|
||||
FROM MediaItem mi
|
||||
INNER JOIN Movie m on m.Id = mi.Id");
|
||||
|
||||
// episode versions
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO MediaVersion (Name, Duration, SampleAspectRatio, DisplayAspectRatio, VideoCodec, AudioCodec, VideoScanKind, Width, Height, EpisodeId, MovieId)
|
||||
SELECT 'Main', mi.Statistics_Duration, mi.Statistics_SampleAspectRatio, mi.Statistics_DisplayAspectRatio, mi.Statistics_VideoCodec, mi.Statistics_AudioCodec, mi.Statistics_VideoScanType, mi.Statistics_Width, mi.Statistics_Height, e.Id, null
|
||||
FROM MediaItem mi
|
||||
INNER JOIN Episode e on e.Id = mi.Id");
|
||||
|
||||
// movie files
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO MediaFile (Path, MediaVersionId)
|
||||
SELECT mi.Path, mv.Id
|
||||
FROM MediaItem mi
|
||||
INNER JOIN MediaVersion mv ON mv.MovieId = mi.Id");
|
||||
|
||||
// episode files
|
||||
migrationBuilder.Sql(
|
||||
@"INSERT INTO MediaFile (Path, MediaVersionId)
|
||||
SELECT mi.Path, mv.Id
|
||||
FROM MediaItem mi
|
||||
INNER JOIN MediaVersion mv ON mv.EpisodeId = mi.Id");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1455
File diff suppressed because it is too large
Load Diff
+189
@@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class CleanUp_MediaItemStatisticsAndPath : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_MediaItem_Path",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"LastWriteTime",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Path",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_AudioCodec",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_DisplayAspectRatio",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_Duration",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_Height",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_LastWriteTime",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_SampleAspectRatio",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_VideoCodec",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_VideoScanType",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"Statistics_Width",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"TelevisionEpisodeId",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"TelevisionSeasonId",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"TelevisionShowId",
|
||||
"MediaItem");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
"DateAdded",
|
||||
"MediaVersion",
|
||||
"TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
"DateUpdated",
|
||||
"MediaVersion",
|
||||
"TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
"DateAdded",
|
||||
"MediaVersion");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"DateUpdated",
|
||||
"MediaVersion");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
"LastWriteTime",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Path",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Statistics_AudioCodec",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Statistics_DisplayAspectRatio",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<TimeSpan>(
|
||||
"Statistics_Duration",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"Statistics_Height",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
"Statistics_LastWriteTime",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Statistics_SampleAspectRatio",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Statistics_VideoCodec",
|
||||
"MediaItem",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"Statistics_VideoScanType",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"Statistics_Width",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"TelevisionEpisodeId",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"TelevisionSeasonId",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"TelevisionShowId",
|
||||
"MediaItem",
|
||||
"INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaItem_Path",
|
||||
"MediaItem",
|
||||
"Path",
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1455
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Update_MediaVersionDateAdded : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
var now = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.FFFFFFF");
|
||||
migrationBuilder.Sql($@"UPDATE MediaVersion SET DateAdded = '{now}'");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1462
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,119 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_PlayoutDeleteCascades : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_CollectionId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_MediaItem_MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_Collection_CollectionId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_MediaItem_MediaItemId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_MediaFile_Path",
|
||||
"MediaFile",
|
||||
"Path",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_CollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"CollectionId",
|
||||
"Collection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_MediaItem_MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"MediaItemId",
|
||||
"MediaItem",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_Collection_CollectionId",
|
||||
"ProgramScheduleItem",
|
||||
"CollectionId",
|
||||
"Collection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_MediaItem_MediaItemId",
|
||||
"ProgramScheduleItem",
|
||||
"MediaItemId",
|
||||
"MediaItem",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_CollectionId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_MediaItem_MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_Collection_CollectionId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_ProgramScheduleItem_MediaItem_MediaItemId",
|
||||
"ProgramScheduleItem");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_MediaFile_Path",
|
||||
"MediaFile");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_Collection_CollectionId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"CollectionId",
|
||||
"Collection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_PlayoutProgramScheduleAnchor_MediaItem_MediaItemId",
|
||||
"PlayoutProgramScheduleAnchor",
|
||||
"MediaItemId",
|
||||
"MediaItem",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_Collection_CollectionId",
|
||||
"ProgramScheduleItem",
|
||||
"CollectionId",
|
||||
"Collection",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_ProgramScheduleItem_MediaItem_MediaItemId",
|
||||
"ProgramScheduleItem",
|
||||
"MediaItemId",
|
||||
"MediaItem",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1474
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Add_ChannelArtwork : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
"ChannelId",
|
||||
"Artwork",
|
||||
"INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
"IX_Artwork_ChannelId",
|
||||
"Artwork",
|
||||
"ChannelId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
"FK_Artwork_Channel_ChannelId",
|
||||
"Artwork",
|
||||
"ChannelId",
|
||||
"Channel",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
"FK_Artwork_Channel_ChannelId",
|
||||
"Artwork");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
"IX_Artwork_ChannelId",
|
||||
"Artwork");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
"ChannelId",
|
||||
"Artwork");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1474
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Update_ChannelArtwork : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
var now = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.FFFFFFF");
|
||||
|
||||
migrationBuilder.Sql(
|
||||
$@"INSERT INTO Artwork (ArtworkKind, ChannelId, DateAdded, DateUpdated, Path)
|
||||
SELECT 2, c.Id, '{now}', '{now}', c.Logo
|
||||
FROM Channel c
|
||||
WHERE c.Logo is not null");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+1471
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Migrations
|
||||
{
|
||||
public partial class Remove_ChannelLogo : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.DropColumn(
|
||||
"Logo",
|
||||
"Channel");
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder) =>
|
||||
migrationBuilder.AddColumn<string>(
|
||||
"Logo",
|
||||
"Channel",
|
||||
"TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user