From 6f06f962d733e116022567b87df44b927dd2ce4e Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 3 Feb 2018 00:04:55 +0000 Subject: [PATCH] Fixed the migration issue, it's too difficult to migrate the tables --- .../Jobs/Plex/PlexContentSync.cs | 6 + ...11930_DropPlexUniqueConstraint.Designer.cs | 914 ------------------ ...20180201211930_DropPlexUniqueConstraint.cs | 60 -- 3 files changed, 6 insertions(+), 974 deletions(-) delete mode 100644 src/Ombi.Store/Migrations/20180201211930_DropPlexUniqueConstraint.Designer.cs delete mode 100644 src/Ombi.Store/Migrations/20180201211930_DropPlexUniqueConstraint.cs diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs index e44deb1df..ce53e8162 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs @@ -213,6 +213,12 @@ namespace Ombi.Schedule.Jobs.Plex continue; } + var hasSameKey = await Repo.GetByKey(movie.ratingKey); + if (hasSameKey != null) + { + await Repo.Delete(hasSameKey); + } + Logger.LogInformation("Adding movie {0}", movie.title); var metaData = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri, movie.ratingKey); diff --git a/src/Ombi.Store/Migrations/20180201211930_DropPlexUniqueConstraint.Designer.cs b/src/Ombi.Store/Migrations/20180201211930_DropPlexUniqueConstraint.Designer.cs deleted file mode 100644 index 1db758e00..000000000 --- a/src/Ombi.Store/Migrations/20180201211930_DropPlexUniqueConstraint.Designer.cs +++ /dev/null @@ -1,914 +0,0 @@ -// -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage; -using Microsoft.EntityFrameworkCore.Storage.Internal; -using Ombi.Helpers; -using Ombi.Store.Context; -using Ombi.Store.Entities; -using Ombi.Store.Entities.Requests; -using System; - -namespace Ombi.Store.Migrations -{ - [DbContext(typeof(OmbiContext))] - [Migration("20180201211930_DropPlexUniqueConstraint")] - partial class DropPlexUniqueConstraint - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.0.0-rtm-26452"); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); - - b.Property("Name") - .HasMaxLength(256); - - b.Property("NormalizedName") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasName("RoleNameIndex"); - - b.ToTable("AspNetRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ClaimType"); - - b.Property("ClaimValue"); - - b.Property("RoleId") - .IsRequired(); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ClaimType"); - - b.Property("ClaimValue"); - - b.Property("UserId") - .IsRequired(); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider"); - - b.Property("ProviderKey"); - - b.Property("ProviderDisplayName"); - - b.Property("UserId") - .IsRequired(); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId"); - - b.Property("RoleId"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId"); - - b.Property("LoginProvider"); - - b.Property("Name"); - - b.Property("Value"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Type"); - - b.Property("Value"); - - b.HasKey("Id"); - - b.ToTable("ApplicationConfiguration"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Audit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AuditArea"); - - b.Property("AuditType"); - - b.Property("DateTime"); - - b.Property("Description"); - - b.Property("User"); - - b.HasKey("Id"); - - b.ToTable("Audit"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("TheMovieDbId"); - - b.HasKey("Id"); - - b.ToTable("CouchPotatoCache"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AddedAt"); - - b.Property("EmbyId") - .IsRequired(); - - b.Property("ProviderId"); - - b.Property("Title"); - - b.Property("Type"); - - b.HasKey("Id"); - - b.ToTable("EmbyContent"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AddedAt"); - - b.Property("EmbyId"); - - b.Property("EpisodeNumber"); - - b.Property("ParentId"); - - b.Property("ProviderId"); - - b.Property("SeasonNumber"); - - b.Property("Title"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("EmbyEpisode"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Content"); - - b.Property("SettingsName"); - - b.HasKey("Id"); - - b.ToTable("GlobalSettings"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Agent"); - - b.Property("Enabled"); - - b.Property("Message"); - - b.Property("NotificationType"); - - b.Property("Subject"); - - b.HasKey("Id"); - - b.ToTable("NotificationTemplates"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AddedAt"); - - b.Property("PlayerId"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("NotificationUserId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessFailedCount"); - - b.Property("Alias"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); - - b.Property("Email") - .HasMaxLength(256); - - b.Property("EmailConfirmed"); - - b.Property("EmbyConnectUserId"); - - b.Property("EpisodeRequestLimit"); - - b.Property("LastLoggedIn"); - - b.Property("LockoutEnabled"); - - b.Property("LockoutEnd"); - - b.Property("MovieRequestLimit"); - - b.Property("NormalizedEmail") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .HasMaxLength(256); - - b.Property("PasswordHash"); - - b.Property("PhoneNumber"); - - b.Property("PhoneNumberConfirmed"); - - b.Property("ProviderUserId"); - - b.Property("SecurityStamp"); - - b.Property("TwoFactorEnabled"); - - b.Property("UserAccessToken"); - - b.Property("UserName") - .HasMaxLength(256); - - b.Property("UserType"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasName("UserNameIndex"); - - b.ToTable("AspNetUsers"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EpisodeNumber"); - - b.Property("GrandparentKey"); - - b.Property("Key"); - - b.Property("ParentKey"); - - b.Property("SeasonNumber"); - - b.Property("Title"); - - b.HasKey("Id"); - - b.HasIndex("GrandparentKey"); - - b.ToTable("PlexEpisode"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ParentKey"); - - b.Property("PlexContentId"); - - b.Property("PlexServerContentId"); - - b.Property("SeasonKey"); - - b.Property("SeasonNumber"); - - b.HasKey("Id"); - - b.HasIndex("PlexServerContentId"); - - b.ToTable("PlexSeasonsContent"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AddedAt"); - - b.Property("ImdbId"); - - b.Property("Key"); - - b.Property("Quality"); - - b.Property("ReleaseYear"); - - b.Property("TheMovieDbId"); - - b.Property("Title"); - - b.Property("TvDbId"); - - b.Property("Type"); - - b.Property("Url"); - - b.HasKey("Id"); - - b.ToTable("PlexServerContent"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("HasFile"); - - b.Property("TheMovieDbId"); - - b.HasKey("Id"); - - b.ToTable("RadarrCache"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Approved"); - - b.Property("Available"); - - b.Property("Denied"); - - b.Property("DeniedReason"); - - b.Property("IssueId"); - - b.Property("ParentRequestId"); - - b.Property("RequestType"); - - b.Property("RequestedDate"); - - b.Property("RequestedUserId"); - - b.Property("SeriesType"); - - b.Property("Title"); - - b.HasKey("Id"); - - b.HasIndex("ParentRequestId"); - - b.HasIndex("RequestedUserId"); - - b.ToTable("ChildRequests"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Value"); - - b.HasKey("Id"); - - b.ToTable("IssueCategory"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Comment"); - - b.Property("Date"); - - b.Property("IssuesId"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("IssuesId"); - - b.HasIndex("UserId"); - - b.ToTable("IssueComments"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Description"); - - b.Property("IssueCategoryId"); - - b.Property("IssueId"); - - b.Property("ProviderId"); - - b.Property("RequestId"); - - b.Property("RequestType"); - - b.Property("ResovledDate"); - - b.Property("Status"); - - b.Property("Subject"); - - b.Property("Title"); - - b.Property("UserReportedId"); - - b.HasKey("Id"); - - b.HasIndex("IssueCategoryId"); - - b.HasIndex("IssueId"); - - b.HasIndex("UserReportedId"); - - b.ToTable("Issues"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Approved"); - - b.Property("Available"); - - b.Property("Background"); - - b.Property("Denied"); - - b.Property("DeniedReason"); - - b.Property("ImdbId"); - - b.Property("IssueId"); - - b.Property("Overview"); - - b.Property("PosterPath"); - - b.Property("QualityOverride"); - - b.Property("ReleaseDate"); - - b.Property("RequestType"); - - b.Property("RequestedDate"); - - b.Property("RequestedUserId"); - - b.Property("RootPathOverride"); - - b.Property("Status"); - - b.Property("TheMovieDbId"); - - b.Property("Title"); - - b.HasKey("Id"); - - b.HasIndex("RequestedUserId"); - - b.ToTable("MovieRequests"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EpisodeCount"); - - b.Property("RequestDate"); - - b.Property("RequestId"); - - b.Property("RequestType"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("RequestLog"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ImdbId"); - - b.Property("Overview"); - - b.Property("PosterPath"); - - b.Property("ReleaseDate"); - - b.Property("RootFolder"); - - b.Property("Status"); - - b.Property("Title"); - - b.Property("TvDbId"); - - b.HasKey("Id"); - - b.ToTable("TvRequests"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("TvDbId"); - - b.HasKey("Id"); - - b.ToTable("SickRageCache"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EpisodeNumber"); - - b.Property("SeasonNumber"); - - b.Property("TvDbId"); - - b.HasKey("Id"); - - b.ToTable("SickRageEpisodeCache"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("TvDbId"); - - b.HasKey("Id"); - - b.ToTable("SonarrCache"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EpisodeNumber"); - - b.Property("HasFile"); - - b.Property("SeasonNumber"); - - b.Property("TvDbId"); - - b.HasKey("Id"); - - b.ToTable("SonarrEpisodeCache"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Token"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Tokens"); - }); - - modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AirDate"); - - b.Property("Approved"); - - b.Property("Available"); - - b.Property("EpisodeNumber"); - - b.Property("Requested"); - - b.Property("SeasonId"); - - b.Property("Title"); - - b.Property("Url"); - - b.HasKey("Id"); - - b.HasIndex("SeasonId"); - - b.ToTable("EpisodeRequests"); - }); - - modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ChildRequestId"); - - b.Property("SeasonNumber"); - - b.HasKey("Id"); - - b.HasIndex("ChildRequestId"); - - b.ToTable("SeasonRequests"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Ombi.Store.Entities.OmbiUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Ombi.Store.Entities.OmbiUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("Ombi.Store.Entities.OmbiUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Ombi.Store.Entities.OmbiUser") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b => - { - b.HasOne("Ombi.Store.Entities.EmbyContent", "Series") - .WithMany("Episodes") - .HasForeignKey("ParentId") - .HasPrincipalKey("EmbyId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => - { - b.HasOne("Ombi.Store.Entities.OmbiUser", "User") - .WithMany("NotificationUserIds") - .HasForeignKey("UserId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b => - { - b.HasOne("Ombi.Store.Entities.PlexServerContent", "Series") - .WithMany("Episodes") - .HasForeignKey("GrandparentKey") - .HasPrincipalKey("Key") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b => - { - b.HasOne("Ombi.Store.Entities.PlexServerContent") - .WithMany("Seasons") - .HasForeignKey("PlexServerContentId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => - { - b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") - .WithMany("ChildRequests") - .HasForeignKey("ParentRequestId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") - .WithMany() - .HasForeignKey("RequestedUserId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => - { - b.HasOne("Ombi.Store.Entities.Requests.Issues", "Issues") - .WithMany("Comments") - .HasForeignKey("IssuesId"); - - b.HasOne("Ombi.Store.Entities.OmbiUser", "User") - .WithMany() - .HasForeignKey("UserId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => - { - b.HasOne("Ombi.Store.Entities.Requests.IssueCategory", "IssueCategory") - .WithMany() - .HasForeignKey("IssueCategoryId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("Ombi.Store.Entities.Requests.ChildRequests") - .WithMany("Issues") - .HasForeignKey("IssueId"); - - b.HasOne("Ombi.Store.Entities.Requests.MovieRequests") - .WithMany("Issues") - .HasForeignKey("IssueId"); - - b.HasOne("Ombi.Store.Entities.OmbiUser", "UserReported") - .WithMany() - .HasForeignKey("UserReportedId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => - { - b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") - .WithMany() - .HasForeignKey("RequestedUserId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => - { - b.HasOne("Ombi.Store.Entities.OmbiUser", "User") - .WithMany() - .HasForeignKey("UserId"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => - { - b.HasOne("Ombi.Store.Entities.OmbiUser", "User") - .WithMany() - .HasForeignKey("UserId"); - }); - - modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => - { - b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season") - .WithMany("Episodes") - .HasForeignKey("SeasonId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => - { - b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") - .WithMany("SeasonRequests") - .HasForeignKey("ChildRequestId") - .OnDelete(DeleteBehavior.Cascade); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Ombi.Store/Migrations/20180201211930_DropPlexUniqueConstraint.cs b/src/Ombi.Store/Migrations/20180201211930_DropPlexUniqueConstraint.cs deleted file mode 100644 index 9da5d22d2..000000000 --- a/src/Ombi.Store/Migrations/20180201211930_DropPlexUniqueConstraint.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; - -namespace Ombi.Store.Migrations -{ - public partial class DropPlexUniqueConstraint : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.Sql(@" - - - CREATE TABLE `PlexServerContent2` ( - `Id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - `AddedAt` TEXT NOT NULL, - `ImdbId` TEXT, - `Key` INTEGER NOT NULL, - `Quality` TEXT, - `ReleaseYear` TEXT, - `TheMovieDbId` TEXT, - `Title` TEXT, - `TvDbId` TEXT, - `Type` INTEGER NOT NULL, - `Url` TEXT -); - -INSERT INTO PlexServerContent2 (AddedAt, ImdbId, Key, Quality, ReleaseYear, TheMovieDbId, Title, TvDbId, Type, Url) - SELECT AddedAt, ImdbId, Key, Quality, ReleaseYear, TheMovieDbId, Title, TvDbId, Type, Url FROM PlexServerContent; - - -CREATE TABLE `PlexEpisode2` ( - `Id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, - `EpisodeNumber` INTEGER NOT NULL, - `GrandparentKey` INTEGER NOT NULL, - `Key` INTEGER NOT NULL, - `ParentKey` INTEGER NOT NULL, - `SeasonNumber` INTEGER NOT NULL, - `Title` TEXT -); -INSERT INTO PlexEpisode2 (EpisodeNumber, GrandparentKey, Key, ParentKey, SeasonNumber, Title) - SELECT EpisodeNumber, GrandparentKey, Key, ParentKey, SeasonNumber, Title FROM PlexEpisode; - -DROP TABLE PlexEpisode; -DROP TABLE PlexServerContent; - -ALTER TABLE PlexServerContent2 RENAME TO PlexServerContent; -ALTER TABLE PlexEpisode2 RENAME TO PlexEpisode; - - PRAGMA foreign_key_check; - - - "); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - } - } -}