mirror of https://github.com/ErsatzTV/ErsatzTV.git
5 changed files with 13618 additions and 1 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.MySql.Migrations |
||||
{ |
||||
/// <inheritdoc />
|
||||
public partial class Update_SubtitleTitle : Migration |
||||
{ |
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.Sql( |
||||
@"UPDATE Subtitle s
|
||||
INNER JOIN EpisodeMetadata em ON em.Id = s.EpisodeMetadataId |
||||
INNER JOIN MediaVersion mv ON mv.EpisodeId = em.EpisodeId |
||||
INNER JOIN MediaStream ms ON ms.MediaVersionId = mv.Id AND ms.MediaStreamKind = 3 AND ms.`Index` = s.StreamIndex |
||||
SET s.Title = ms.Title |
||||
WHERE s.Title != ms.Title;");
|
||||
} |
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
} |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
||||
#nullable disable |
||||
|
||||
namespace ErsatzTV.Infrastructure.Sqlite.Migrations |
||||
{ |
||||
/// <inheritdoc />
|
||||
public partial class Update_SubtitleTitle : Migration |
||||
{ |
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
||||
{ |
||||
migrationBuilder.Sql( |
||||
@"WITH Match AS (
|
||||
SELECT s.Id AS SubtitleId, ms.Title AS NewTitle |
||||
FROM Subtitle AS s |
||||
JOIN EpisodeMetadata AS em ON em.Id = s.EpisodeMetadataId |
||||
JOIN MediaVersion AS mv ON mv.EpisodeId = em.EpisodeId |
||||
JOIN MediaStream AS ms ON ms.MediaVersionId = mv.Id |
||||
WHERE ms.MediaStreamKind = 3 |
||||
AND ms.`Index` = s.StreamIndex |
||||
AND s.Title != ms.Title |
||||
) |
||||
UPDATE Subtitle |
||||
SET Title = (SELECT NewTitle FROM Match WHERE Match.SubtitleId = Subtitle.Id) |
||||
WHERE Id IN (SELECT SubtitleId FROM Match); |
||||
");
|
||||
} |
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
||||
{ |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue