mirror of https://github.com/ErsatzTV/ErsatzTV.git
38 changed files with 21316 additions and 190 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.MySql.Migrations |
||||
{ |
||||
/// <inheritdoc />
|
||||
public partial class Rework_LibraryFolder : Migration |
||||
{ |
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AddColumn<int>( |
||||
name: "LibraryFolderId", |
||||
table: "MediaFile", |
||||
type: "int", |
||||
nullable: true); |
||||
|
||||
migrationBuilder.AddColumn<int>( |
||||
name: "ParentId", |
||||
table: "LibraryFolder", |
||||
type: "int", |
||||
nullable: true); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_MediaFile_LibraryFolderId", |
||||
table: "MediaFile", |
||||
column: "LibraryFolderId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_LibraryFolder_ParentId", |
||||
table: "LibraryFolder", |
||||
column: "ParentId"); |
||||
|
||||
migrationBuilder.AddForeignKey( |
||||
name: "FK_LibraryFolder_LibraryFolder_ParentId", |
||||
table: "LibraryFolder", |
||||
column: "ParentId", |
||||
principalTable: "LibraryFolder", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
|
||||
migrationBuilder.AddForeignKey( |
||||
name: "FK_MediaFile_LibraryFolder_LibraryFolderId", |
||||
table: "MediaFile", |
||||
column: "LibraryFolderId", |
||||
principalTable: "LibraryFolder", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
} |
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropForeignKey( |
||||
name: "FK_LibraryFolder_LibraryFolder_ParentId", |
||||
table: "LibraryFolder"); |
||||
|
||||
migrationBuilder.DropForeignKey( |
||||
name: "FK_MediaFile_LibraryFolder_LibraryFolderId", |
||||
table: "MediaFile"); |
||||
|
||||
migrationBuilder.DropIndex( |
||||
name: "IX_MediaFile_LibraryFolderId", |
||||
table: "MediaFile"); |
||||
|
||||
migrationBuilder.DropIndex( |
||||
name: "IX_LibraryFolder_ParentId", |
||||
table: "LibraryFolder"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
name: "LibraryFolderId", |
||||
table: "MediaFile"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
name: "ParentId", |
||||
table: "LibraryFolder"); |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.MySql.Migrations |
||||
{ |
||||
/// <inheritdoc />
|
||||
public partial class Reset_LocalLibraryFolders : Migration |
||||
{ |
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
// reset local library folders, and require scans
|
||||
|
||||
migrationBuilder.Sql( |
||||
@"UPDATE LibraryPath SET LastScan = '0001-01-01 00:00:00' WHERE Id IN
|
||||
(SELECT LP.Id FROM Library L INNER JOIN LibraryPath LP ON L.Id = LP.LibraryId INNER JOIN LocalMediaSource LMS ON LMS.Id = L.MediaSourceId)");
|
||||
|
||||
migrationBuilder.Sql( |
||||
@"UPDATE Library SET LastScan = '0001-01-01 00:00:00' WHERE MediaSourceId IN (SELECT Id FROM LocalMediaSource)"); |
||||
|
||||
migrationBuilder.Sql( |
||||
@"DELETE FROM LibraryFolder WHERE LibraryPathId IN (SELECT LP.Id FROM Library L INNER JOIN LibraryPath LP ON L.Id = LP.LibraryId INNER JOIN LocalMediaSource LMS ON LMS.Id = L.MediaSourceId)"); |
||||
} |
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.Sqlite.Migrations |
||||
{ |
||||
/// <inheritdoc />
|
||||
public partial class Rework_LibraryFolder : Migration |
||||
{ |
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.AddColumn<int>( |
||||
name: "LibraryFolderId", |
||||
table: "MediaFile", |
||||
type: "INTEGER", |
||||
nullable: true); |
||||
|
||||
migrationBuilder.AddColumn<int>( |
||||
name: "ParentId", |
||||
table: "LibraryFolder", |
||||
type: "INTEGER", |
||||
nullable: true); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_MediaFile_LibraryFolderId", |
||||
table: "MediaFile", |
||||
column: "LibraryFolderId"); |
||||
|
||||
migrationBuilder.CreateIndex( |
||||
name: "IX_LibraryFolder_ParentId", |
||||
table: "LibraryFolder", |
||||
column: "ParentId"); |
||||
|
||||
migrationBuilder.AddForeignKey( |
||||
name: "FK_LibraryFolder_LibraryFolder_ParentId", |
||||
table: "LibraryFolder", |
||||
column: "ParentId", |
||||
principalTable: "LibraryFolder", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
|
||||
migrationBuilder.AddForeignKey( |
||||
name: "FK_MediaFile_LibraryFolder_LibraryFolderId", |
||||
table: "MediaFile", |
||||
column: "LibraryFolderId", |
||||
principalTable: "LibraryFolder", |
||||
principalColumn: "Id", |
||||
onDelete: ReferentialAction.Restrict); |
||||
} |
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.DropForeignKey( |
||||
name: "FK_LibraryFolder_LibraryFolder_ParentId", |
||||
table: "LibraryFolder"); |
||||
|
||||
migrationBuilder.DropForeignKey( |
||||
name: "FK_MediaFile_LibraryFolder_LibraryFolderId", |
||||
table: "MediaFile"); |
||||
|
||||
migrationBuilder.DropIndex( |
||||
name: "IX_MediaFile_LibraryFolderId", |
||||
table: "MediaFile"); |
||||
|
||||
migrationBuilder.DropIndex( |
||||
name: "IX_LibraryFolder_ParentId", |
||||
table: "LibraryFolder"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
name: "LibraryFolderId", |
||||
table: "MediaFile"); |
||||
|
||||
migrationBuilder.DropColumn( |
||||
name: "ParentId", |
||||
table: "LibraryFolder"); |
||||
} |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.Sqlite.Migrations |
||||
{ |
||||
/// <inheritdoc />
|
||||
public partial class Reset_LocalLibraryFolders : Migration |
||||
{ |
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
// reset local library folders, and require scans
|
||||
|
||||
migrationBuilder.Sql( |
||||
@"UPDATE LibraryPath SET LastScan = '0001-01-01 00:00:00' WHERE Id IN
|
||||
(SELECT LP.Id FROM Library L INNER JOIN LibraryPath LP ON L.Id = LP.LibraryId INNER JOIN LocalMediaSource LMS ON LMS.Id = L.MediaSourceId)");
|
||||
|
||||
migrationBuilder.Sql( |
||||
@"UPDATE Library SET LastScan = '0001-01-01 00:00:00' WHERE MediaSourceId IN (SELECT Id FROM LocalMediaSource)"); |
||||
|
||||
migrationBuilder.Sql( |
||||
@"DELETE FROM LibraryFolder WHERE LibraryPathId IN (SELECT LP.Id FROM Library L INNER JOIN LibraryPath LP ON L.Id = LP.LibraryId INNER JOIN LocalMediaSource LMS ON LMS.Id = L.MediaSourceId)"); |
||||
} |
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue