diff --git a/src/Ombi.Store/Context/MySql/OmbiMySqlContext.cs b/src/Ombi.Store/Context/MySql/OmbiMySqlContext.cs index 073a0ed1a..c0b46d7c0 100644 --- a/src/Ombi.Store/Context/MySql/OmbiMySqlContext.cs +++ b/src/Ombi.Store/Context/MySql/OmbiMySqlContext.cs @@ -5,6 +5,7 @@ namespace Ombi.Store.Context.MySql public sealed class OmbiMySqlContext : OmbiContext { private static bool _created; + public OmbiMySqlContext(DbContextOptions options) : base(options) { if (_created) return; diff --git a/src/Ombi.Store/Context/OmbiContext.cs b/src/Ombi.Store/Context/OmbiContext.cs index 2b145c7f2..b4a469fbd 100644 --- a/src/Ombi.Store/Context/OmbiContext.cs +++ b/src/Ombi.Store/Context/OmbiContext.cs @@ -18,6 +18,7 @@ namespace Ombi.Store.Context } + /// /// This allows a sub class to call the base class 'DbContext' non typed constructor /// This is need because instances of the subclasses will use a specific typed DbContextOptions @@ -50,6 +51,7 @@ namespace Ombi.Store.Context public DbSet Tokens { get; set; } public DbSet RequestSubscription { get; set; } public DbSet UserNotificationPreferences { get; set; } + public DbSet MobileDevices { get; set; } public DbSet UserQualityProfileses { get; set; } public DbSet RequestQueue { get; set; } diff --git a/src/Ombi.Store/Entities/MobileDevices.cs b/src/Ombi.Store/Entities/MobileDevices.cs new file mode 100644 index 000000000..674cb8df9 --- /dev/null +++ b/src/Ombi.Store/Entities/MobileDevices.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Ombi.Store.Entities +{ + public class MobileDevices : Entity + { + public string Token { get; set; } + public string UserId { get; set; } + public DateTime AddedAt { get; set; } + [ForeignKey(nameof(UserId))] + public OmbiUser User { get; set; } + } +} \ No newline at end of file diff --git a/src/Ombi.Store/Migrations/ExternalMySql/ExternalMySqlContextModelSnapshot.cs b/src/Ombi.Store/Migrations/ExternalMySql/ExternalMySqlContextModelSnapshot.cs index c9ca6fc74..890e24b76 100644 --- a/src/Ombi.Store/Migrations/ExternalMySql/ExternalMySqlContextModelSnapshot.cs +++ b/src/Ombi.Store/Migrations/ExternalMySql/ExternalMySqlContextModelSnapshot.cs @@ -14,15 +14,17 @@ namespace Ombi.Store.Migrations.ExternalMySql { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.1.1") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("TheMovieDbId"); + b.Property("TheMovieDbId") + .HasColumnType("int"); b.HasKey("Id"); @@ -32,26 +34,36 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("AddedAt"); + b.Property("AddedAt") + .HasColumnType("datetime(6)"); b.Property("EmbyId") - .IsRequired(); + .IsRequired() + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("ImdbId"); + b.Property("ImdbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ProviderId"); + b.Property("ProviderId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("TheMovieDbId"); + b.Property("TheMovieDbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Type"); + b.Property("Type") + .HasColumnType("int"); - b.Property("Url"); + b.Property("Url") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -61,27 +73,38 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("AddedAt"); + b.Property("AddedAt") + .HasColumnType("datetime(6)"); - b.Property("EmbyId"); + b.Property("EmbyId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("EpisodeNumber"); + b.Property("EpisodeNumber") + .HasColumnType("int"); - b.Property("ImdbId"); + b.Property("ImdbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ParentId"); + b.Property("ParentId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("ProviderId"); + b.Property("ProviderId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("int"); - b.Property("TheMovieDbId"); + b.Property("TheMovieDbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -93,23 +116,32 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("AddedAt"); + b.Property("AddedAt") + .HasColumnType("datetime(6)"); - b.Property("ArtistId"); + b.Property("ArtistId") + .HasColumnType("int"); - b.Property("ForeignAlbumId"); + b.Property("ForeignAlbumId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Monitored"); + b.Property("Monitored") + .HasColumnType("tinyint(1)"); - b.Property("PercentOfTracks"); + b.Property("PercentOfTracks") + .HasColumnType("decimal(65,30)"); - b.Property("ReleaseDate"); + b.Property("ReleaseDate") + .HasColumnType("datetime(6)"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("TrackCount"); + b.Property("TrackCount") + .HasColumnType("int"); b.HasKey("Id"); @@ -119,15 +151,20 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.LidarrArtistCache", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("ArtistId"); + b.Property("ArtistId") + .HasColumnType("int"); - b.Property("ArtistName"); + b.Property("ArtistName") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ForeignArtistId"); + b.Property("ForeignArtistId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Monitored"); + b.Property("Monitored") + .HasColumnType("tinyint(1)"); b.HasKey("Id"); @@ -137,19 +174,26 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("EpisodeNumber"); + b.Property("EpisodeNumber") + .HasColumnType("int"); - b.Property("GrandparentKey"); + b.Property("GrandparentKey") + .HasColumnType("int"); - b.Property("Key"); + b.Property("Key") + .HasColumnType("int"); - b.Property("ParentKey"); + b.Property("ParentKey") + .HasColumnType("int"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("int"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -161,17 +205,23 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("ParentKey"); + b.Property("ParentKey") + .HasColumnType("int"); - b.Property("PlexContentId"); + b.Property("PlexContentId") + .HasColumnType("int"); - b.Property("PlexServerContentId"); + b.Property("PlexServerContentId") + .HasColumnType("int"); - b.Property("SeasonKey"); + b.Property("SeasonKey") + .HasColumnType("int"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("int"); b.HasKey("Id"); @@ -183,29 +233,41 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("AddedAt"); + b.Property("AddedAt") + .HasColumnType("datetime(6)"); - b.Property("ImdbId"); + b.Property("ImdbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Key"); + b.Property("Key") + .HasColumnType("int"); - b.Property("Quality"); + b.Property("Quality") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ReleaseYear"); + b.Property("ReleaseYear") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("int"); - b.Property("TheMovieDbId"); + b.Property("TheMovieDbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Type"); + b.Property("Type") + .HasColumnType("int"); - b.Property("Url"); + b.Property("Url") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -215,11 +277,14 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("HasFile"); + b.Property("HasFile") + .HasColumnType("tinyint(1)"); - b.Property("TheMovieDbId"); + b.Property("TheMovieDbId") + .HasColumnType("int"); b.HasKey("Id"); @@ -229,9 +294,11 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("int"); b.HasKey("Id"); @@ -241,13 +308,17 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("EpisodeNumber"); + b.Property("EpisodeNumber") + .HasColumnType("int"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("int"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("int"); b.HasKey("Id"); @@ -257,9 +328,11 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("int"); b.HasKey("Id"); @@ -269,15 +342,20 @@ namespace Ombi.Store.Migrations.ExternalMySql modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("EpisodeNumber"); + b.Property("EpisodeNumber") + .HasColumnType("int"); - b.Property("HasFile"); + b.Property("HasFile") + .HasColumnType("tinyint(1)"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("int"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("int"); b.HasKey("Id"); @@ -298,12 +376,13 @@ namespace Ombi.Store.Migrations.ExternalMySql .WithMany("Episodes") .HasForeignKey("GrandparentKey") .HasPrincipalKey("Key") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b => { - b.HasOne("Ombi.Store.Entities.PlexServerContent") + b.HasOne("Ombi.Store.Entities.PlexServerContent", null) .WithMany("Seasons") .HasForeignKey("PlexServerContentId"); }); diff --git a/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.Designer.cs b/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.Designer.cs new file mode 100644 index 000000000..b92f5ca05 --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.Designer.cs @@ -0,0 +1,1155 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Ombi.Store.Context.MySql; + +namespace Ombi.Store.Migrations.OmbiMySql +{ + [DbContext(typeof(OmbiMySqlContext))] + [Migration("20200218230644_MobileDevices")] + partial class MobileDevices + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.1") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Name") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("NormalizedName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .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() + .HasColumnType("int"); + + b.Property("ClaimType") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ClaimValue") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ClaimType") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ClaimValue") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("RoleId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("Value") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AuditArea") + .HasColumnType("int"); + + b.Property("AuditType") + .HasColumnType("int"); + + b.Property("DateTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("User") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AddedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("MobileDevices"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Agent") + .HasColumnType("int"); + + b.Property("Enabled") + .HasColumnType("tinyint(1)"); + + b.Property("Message") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("NotificationType") + .HasColumnType("int"); + + b.Property("Subject") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("NotificationTemplates"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AddedAt") + .HasColumnType("datetime(6)"); + + b.Property("PlayerId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("NotificationUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("Alias") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Email") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("EmbyConnectUserId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("EpisodeRequestLimit") + .HasColumnType("int"); + + b.Property("LastLoggedIn") + .HasColumnType("datetime(6)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("MovieRequestLimit") + .HasColumnType("int"); + + b.Property("MusicRequestLimit") + .HasColumnType("int"); + + b.Property("NormalizedEmail") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("PhoneNumber") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("ProviderUserId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("SecurityStamp") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserAccessToken") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("UserType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AddedAt") + .HasColumnType("datetime(6)"); + + b.Property("AlbumId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ContentId") + .HasColumnType("int"); + + b.Property("ContentType") + .HasColumnType("int"); + + b.Property("EpisodeNumber") + .HasColumnType("int"); + + b.Property("SeasonNumber") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("RecentlyAddedLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Completed") + .HasColumnType("datetime(6)"); + + b.Property("Dts") + .HasColumnType("datetime(6)"); + + b.Property("Error") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("RequestId") + .HasColumnType("int"); + + b.Property("RetryCount") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("RequestQueue"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("RequestId") + .HasColumnType("int"); + + b.Property("RequestType") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestSubscription"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Approved") + .HasColumnType("tinyint(1)"); + + b.Property("ArtistName") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Available") + .HasColumnType("tinyint(1)"); + + b.Property("Cover") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Denied") + .HasColumnType("tinyint(1)"); + + b.Property("DeniedReason") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Disk") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ForeignAlbumId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ForeignArtistId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("MarkedAsApproved") + .HasColumnType("datetime(6)"); + + b.Property("MarkedAsAvailable") + .HasColumnType("datetime(6)"); + + b.Property("MarkedAsDenied") + .HasColumnType("datetime(6)"); + + b.Property("Rating") + .HasColumnType("decimal(65,30)"); + + b.Property("ReleaseDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestType") + .HasColumnType("int"); + + b.Property("RequestedByAlias") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("RequestedDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestedUserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("AlbumRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Approved") + .HasColumnType("tinyint(1)"); + + b.Property("Available") + .HasColumnType("tinyint(1)"); + + b.Property("Denied") + .HasColumnType("tinyint(1)"); + + b.Property("DeniedReason") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IssueId") + .HasColumnType("int"); + + b.Property("MarkedAsApproved") + .HasColumnType("datetime(6)"); + + b.Property("MarkedAsAvailable") + .HasColumnType("datetime(6)"); + + b.Property("MarkedAsDenied") + .HasColumnType("datetime(6)"); + + b.Property("ParentRequestId") + .HasColumnType("int"); + + b.Property("RequestType") + .HasColumnType("int"); + + b.Property("RequestedByAlias") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("RequestedDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestedUserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("SeriesType") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("ParentRequestId"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("IssueCategory"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Comment") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("IssuesId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("IssuesId"); + + b.HasIndex("UserId"); + + b.ToTable("IssueComments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("EpisodeNumber") + .HasColumnType("int"); + + b.Property("IssueCategoryId") + .HasColumnType("int"); + + b.Property("IssueId") + .HasColumnType("int"); + + b.Property("ProviderId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("RequestId") + .HasColumnType("int"); + + b.Property("RequestType") + .HasColumnType("int"); + + b.Property("ResovledDate") + .HasColumnType("datetime(6)"); + + b.Property("SeasonNumber") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Subject") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserReportedId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + 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() + .HasColumnType("int"); + + b.Property("Approved") + .HasColumnType("tinyint(1)"); + + b.Property("Available") + .HasColumnType("tinyint(1)"); + + b.Property("Background") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Denied") + .HasColumnType("tinyint(1)"); + + b.Property("DeniedReason") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DigitalReleaseDate") + .HasColumnType("datetime(6)"); + + b.Property("ImdbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IssueId") + .HasColumnType("int"); + + b.Property("LangCode") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("MarkedAsApproved") + .HasColumnType("datetime(6)"); + + b.Property("MarkedAsAvailable") + .HasColumnType("datetime(6)"); + + b.Property("MarkedAsDenied") + .HasColumnType("datetime(6)"); + + b.Property("Overview") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("PosterPath") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("QualityOverride") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestType") + .HasColumnType("int"); + + b.Property("RequestedByAlias") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("RequestedDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestedUserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("RootPathOverride") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("TheMovieDbId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MovieRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("EpisodeCount") + .HasColumnType("int"); + + b.Property("RequestDate") + .HasColumnType("datetime(6)"); + + b.Property("RequestId") + .HasColumnType("int"); + + b.Property("RequestType") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Background") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ImdbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Overview") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("PosterPath") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("QualityOverride") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("datetime(6)"); + + b.Property("RootFolder") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("TotalSeasons") + .HasColumnType("int"); + + b.Property("TvDbId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("TvRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Token") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Tokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Agent") + .HasColumnType("int"); + + b.Property("Enabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("Value") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("RadarrQualityProfile") + .HasColumnType("int"); + + b.Property("RadarrRootPath") + .HasColumnType("int"); + + b.Property("SonarrQualityProfile") + .HasColumnType("int"); + + b.Property("SonarrQualityProfileAnime") + .HasColumnType("int"); + + b.Property("SonarrRootPath") + .HasColumnType("int"); + + b.Property("SonarrRootPathAnime") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserQualityProfiles"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("Deleted") + .HasColumnType("tinyint(1)"); + + b.Property("RequestId") + .HasColumnType("int"); + + b.Property("RequestType") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.Property("VoteType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Votes"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AirDate") + .HasColumnType("datetime(6)"); + + b.Property("Approved") + .HasColumnType("tinyint(1)"); + + b.Property("Available") + .HasColumnType("tinyint(1)"); + + b.Property("EpisodeNumber") + .HasColumnType("int"); + + b.Property("Requested") + .HasColumnType("tinyint(1)"); + + b.Property("SeasonId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Url") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("SeasonId"); + + b.ToTable("EpisodeRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ChildRequestId") + .HasColumnType("int"); + + b.Property("SeasonNumber") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ChildRequestId"); + + b.ToTable("SeasonRequests"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("NotificationUserIds") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") + .WithMany("ChildRequests") + .HasForeignKey("ParentRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", null) + .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.Entities.UserNotificationPreferences", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("UserNotificationPreferences") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", 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) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") + .WithMany("SeasonRequests") + .HasForeignKey("ChildRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.cs b/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.cs new file mode 100644 index 000000000..d5684c54c --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiMySql/20200218230644_MobileDevices.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Ombi.Store.Migrations.OmbiMySql +{ + public partial class MobileDevices : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "EpisodeNumber", + table: "Issues", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SeasonNumber", + table: "Issues", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "MobileDevices", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Token = table.Column(nullable: true), + UserId = table.Column(nullable: true), + AddedAt = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MobileDevices", x => x.Id); + table.ForeignKey( + name: "FK_MobileDevices_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_MobileDevices_UserId", + table: "MobileDevices", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "MobileDevices"); + + migrationBuilder.DropColumn( + name: "EpisodeNumber", + table: "Issues"); + + migrationBuilder.DropColumn( + name: "SeasonNumber", + table: "Issues"); + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiMySql/OmbiMySqlContextModelSnapshot.cs b/src/Ombi.Store/Migrations/OmbiMySql/OmbiMySqlContextModelSnapshot.cs index 7952ce974..18e588e47 100644 --- a/src/Ombi.Store/Migrations/OmbiMySql/OmbiMySqlContextModelSnapshot.cs +++ b/src/Ombi.Store/Migrations/OmbiMySql/OmbiMySqlContextModelSnapshot.cs @@ -3,7 +3,6 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Ombi.Store.Context; using Ombi.Store.Context.MySql; namespace Ombi.Store.Migrations.OmbiMySql @@ -15,21 +14,24 @@ namespace Ombi.Store.Migrations.OmbiMySql { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.1.1") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("Name") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") .HasMaxLength(256); b.HasKey("Id"); @@ -44,14 +46,18 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -63,14 +69,18 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -81,14 +91,18 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.Property("LoginProvider"); + b.Property("LoginProvider") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("ProviderKey"); + b.Property("ProviderKey") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("LoginProvider", "ProviderKey"); @@ -99,9 +113,11 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("UserId", "RoleId"); @@ -112,13 +128,17 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("LoginProvider"); + b.Property("LoginProvider") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("Name"); + b.Property("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -128,37 +148,71 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Audit", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("AuditArea"); + b.Property("AuditArea") + .HasColumnType("int"); - b.Property("AuditType"); + b.Property("AuditType") + .HasColumnType("int"); - b.Property("DateTime"); + b.Property("DateTime") + .HasColumnType("datetime(6)"); - b.Property("Description"); + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("User"); + b.Property("User") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); b.ToTable("Audit"); }); + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AddedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("MobileDevices"); + }); + modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Agent"); + b.Property("Agent") + .HasColumnType("int"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("tinyint(1)"); - b.Property("Message"); + b.Property("Message") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("NotificationType"); + b.Property("NotificationType") + .HasColumnType("int"); - b.Property("Subject"); + b.Property("Subject") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -168,13 +222,17 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("AddedAt"); + b.Property("AddedAt") + .HasColumnType("datetime(6)"); - b.Property("PlayerId"); + b.Property("PlayerId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -186,58 +244,81 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("int"); - b.Property("Alias"); + b.Property("Alias") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("Email") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); - b.Property("EmbyConnectUserId"); + b.Property("EmbyConnectUserId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("EpisodeRequestLimit"); + b.Property("EpisodeRequestLimit") + .HasColumnType("int"); - b.Property("LastLoggedIn"); + b.Property("LastLoggedIn") + .HasColumnType("datetime(6)"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); - b.Property("MovieRequestLimit"); + b.Property("MovieRequestLimit") + .HasColumnType("int"); - b.Property("MusicRequestLimit"); + b.Property("MusicRequestLimit") + .HasColumnType("int"); b.Property("NormalizedEmail") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); - b.Property("ProviderUserId"); + b.Property("ProviderUserId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); - b.Property("UserAccessToken"); + b.Property("UserAccessToken") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.Property("UserName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") .HasMaxLength(256); - b.Property("UserType"); + b.Property("UserType") + .HasColumnType("int"); b.HasKey("Id"); @@ -254,21 +335,29 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("AddedAt"); + b.Property("AddedAt") + .HasColumnType("datetime(6)"); - b.Property("AlbumId"); + b.Property("AlbumId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ContentId"); + b.Property("ContentId") + .HasColumnType("int"); - b.Property("ContentType"); + b.Property("ContentType") + .HasColumnType("int"); - b.Property("EpisodeNumber"); + b.Property("EpisodeNumber") + .HasColumnType("int"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("int"); - b.Property("Type"); + b.Property("Type") + .HasColumnType("int"); b.HasKey("Id"); @@ -278,19 +367,26 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Completed"); + b.Property("Completed") + .HasColumnType("datetime(6)"); - b.Property("Dts"); + b.Property("Dts") + .HasColumnType("datetime(6)"); - b.Property("Error"); + b.Property("Error") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("int"); - b.Property("RetryCount"); + b.Property("RetryCount") + .HasColumnType("int"); - b.Property("Type"); + b.Property("Type") + .HasColumnType("int"); b.HasKey("Id"); @@ -300,13 +396,17 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("int"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("int"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -318,45 +418,65 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Approved"); + b.Property("Approved") + .HasColumnType("tinyint(1)"); - b.Property("ArtistName"); + b.Property("ArtistName") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Available"); + b.Property("Available") + .HasColumnType("tinyint(1)"); - b.Property("Cover"); + b.Property("Cover") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Denied"); + b.Property("Denied") + .HasColumnType("tinyint(1)"); - b.Property("DeniedReason"); + b.Property("DeniedReason") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Disk"); + b.Property("Disk") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ForeignAlbumId"); + b.Property("ForeignAlbumId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ForeignArtistId"); + b.Property("ForeignArtistId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("MarkedAsApproved"); + b.Property("MarkedAsApproved") + .HasColumnType("datetime(6)"); - b.Property("MarkedAsAvailable"); + b.Property("MarkedAsAvailable") + .HasColumnType("datetime(6)"); - b.Property("MarkedAsDenied"); + b.Property("MarkedAsDenied") + .HasColumnType("datetime(6)"); - b.Property("Rating"); + b.Property("Rating") + .HasColumnType("decimal(65,30)"); - b.Property("ReleaseDate"); + b.Property("ReleaseDate") + .HasColumnType("datetime(6)"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("int"); - b.Property("RequestedByAlias"); + b.Property("RequestedByAlias") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("RequestedDate"); + b.Property("RequestedDate") + .HasColumnType("datetime(6)"); - b.Property("RequestedUserId"); + b.Property("RequestedUserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -368,37 +488,53 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Approved"); + b.Property("Approved") + .HasColumnType("tinyint(1)"); - b.Property("Available"); + b.Property("Available") + .HasColumnType("tinyint(1)"); - b.Property("Denied"); + b.Property("Denied") + .HasColumnType("tinyint(1)"); - b.Property("DeniedReason"); + b.Property("DeniedReason") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("IssueId"); + b.Property("IssueId") + .HasColumnType("int"); - b.Property("MarkedAsApproved"); + b.Property("MarkedAsApproved") + .HasColumnType("datetime(6)"); - b.Property("MarkedAsAvailable"); + b.Property("MarkedAsAvailable") + .HasColumnType("datetime(6)"); - b.Property("MarkedAsDenied"); + b.Property("MarkedAsDenied") + .HasColumnType("datetime(6)"); - b.Property("ParentRequestId"); + b.Property("ParentRequestId") + .HasColumnType("int"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("int"); - b.Property("RequestedByAlias"); + b.Property("RequestedByAlias") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("RequestedDate"); + b.Property("RequestedDate") + .HasColumnType("datetime(6)"); - b.Property("RequestedUserId"); + b.Property("RequestedUserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("SeriesType"); + b.Property("SeriesType") + .HasColumnType("int"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -412,9 +548,11 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -424,15 +562,20 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Comment"); + b.Property("Comment") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Date"); + b.Property("Date") + .HasColumnType("datetime(6)"); - b.Property("IssuesId"); + b.Property("IssuesId") + .HasColumnType("int"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -446,29 +589,47 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Description"); + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("IssueCategoryId"); + b.Property("EpisodeNumber") + .HasColumnType("int"); - b.Property("IssueId"); + b.Property("IssueCategoryId") + .HasColumnType("int"); - b.Property("ProviderId"); + b.Property("IssueId") + .HasColumnType("int"); - b.Property("RequestId"); + b.Property("ProviderId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("RequestType"); + b.Property("RequestId") + .HasColumnType("int"); - b.Property("ResovledDate"); + b.Property("RequestType") + .HasColumnType("int"); - b.Property("Status"); + b.Property("ResovledDate") + .HasColumnType("datetime(6)"); - b.Property("Subject"); + b.Property("SeasonNumber") + .HasColumnType("int"); - b.Property("Title"); + b.Property("Status") + .HasColumnType("int"); - b.Property("UserReportedId"); + b.Property("Subject") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UserReportedId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -484,55 +645,80 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Approved"); + b.Property("Approved") + .HasColumnType("tinyint(1)"); - b.Property("Available"); + b.Property("Available") + .HasColumnType("tinyint(1)"); - b.Property("Background"); + b.Property("Background") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Denied"); + b.Property("Denied") + .HasColumnType("tinyint(1)"); - b.Property("DeniedReason"); + b.Property("DeniedReason") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("DigitalReleaseDate"); + b.Property("DigitalReleaseDate") + .HasColumnType("datetime(6)"); - b.Property("ImdbId"); + b.Property("ImdbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("IssueId"); + b.Property("IssueId") + .HasColumnType("int"); - b.Property("LangCode"); + b.Property("LangCode") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("MarkedAsApproved"); + b.Property("MarkedAsApproved") + .HasColumnType("datetime(6)"); - b.Property("MarkedAsAvailable"); + b.Property("MarkedAsAvailable") + .HasColumnType("datetime(6)"); - b.Property("MarkedAsDenied"); + b.Property("MarkedAsDenied") + .HasColumnType("datetime(6)"); - b.Property("Overview"); + b.Property("Overview") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("PosterPath"); + b.Property("PosterPath") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("QualityOverride"); + b.Property("QualityOverride") + .HasColumnType("int"); - b.Property("ReleaseDate"); + b.Property("ReleaseDate") + .HasColumnType("datetime(6)"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("int"); - b.Property("RequestedByAlias"); + b.Property("RequestedByAlias") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("RequestedDate"); + b.Property("RequestedDate") + .HasColumnType("datetime(6)"); - b.Property("RequestedUserId"); + b.Property("RequestedUserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("RootPathOverride"); + b.Property("RootPathOverride") + .HasColumnType("int"); - b.Property("Status"); + b.Property("Status") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("TheMovieDbId"); + b.Property("TheMovieDbId") + .HasColumnType("int"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -544,17 +730,23 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("EpisodeCount"); + b.Property("EpisodeCount") + .HasColumnType("int"); - b.Property("RequestDate"); + b.Property("RequestDate") + .HasColumnType("datetime(6)"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("int"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("int"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -566,29 +758,41 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Background"); + b.Property("Background") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ImdbId"); + b.Property("ImdbId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Overview"); + b.Property("Overview") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("PosterPath"); + b.Property("PosterPath") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("QualityOverride"); + b.Property("QualityOverride") + .HasColumnType("int"); - b.Property("ReleaseDate"); + b.Property("ReleaseDate") + .HasColumnType("datetime(6)"); - b.Property("RootFolder"); + b.Property("RootFolder") + .HasColumnType("int"); - b.Property("Status"); + b.Property("Status") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("TotalSeasons"); + b.Property("TotalSeasons") + .HasColumnType("int"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("int"); b.HasKey("Id"); @@ -598,11 +802,14 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Token"); + b.Property("Token") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -614,15 +821,20 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Agent"); + b.Property("Agent") + .HasColumnType("int"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("tinyint(1)"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -634,21 +846,29 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("RadarrQualityProfile"); + b.Property("RadarrQualityProfile") + .HasColumnType("int"); - b.Property("RadarrRootPath"); + b.Property("RadarrRootPath") + .HasColumnType("int"); - b.Property("SonarrQualityProfile"); + b.Property("SonarrQualityProfile") + .HasColumnType("int"); - b.Property("SonarrQualityProfileAnime"); + b.Property("SonarrQualityProfileAnime") + .HasColumnType("int"); - b.Property("SonarrRootPath"); + b.Property("SonarrRootPath") + .HasColumnType("int"); - b.Property("SonarrRootPathAnime"); + b.Property("SonarrRootPathAnime") + .HasColumnType("int"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -660,19 +880,26 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Entities.Votes", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("Date"); + b.Property("Date") + .HasColumnType("datetime(6)"); - b.Property("Deleted"); + b.Property("Deleted") + .HasColumnType("tinyint(1)"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("int"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("int"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4"); - b.Property("VoteType"); + b.Property("VoteType") + .HasColumnType("int"); b.HasKey("Id"); @@ -684,23 +911,32 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("AirDate"); + b.Property("AirDate") + .HasColumnType("datetime(6)"); - b.Property("Approved"); + b.Property("Approved") + .HasColumnType("tinyint(1)"); - b.Property("Available"); + b.Property("Available") + .HasColumnType("tinyint(1)"); - b.Property("EpisodeNumber"); + b.Property("EpisodeNumber") + .HasColumnType("int"); - b.Property("Requested"); + b.Property("Requested") + .HasColumnType("tinyint(1)"); - b.Property("SeasonId"); + b.Property("SeasonId") + .HasColumnType("int"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("Url"); + b.Property("Url") + .HasColumnType("longtext CHARACTER SET utf8mb4"); b.HasKey("Id"); @@ -712,11 +948,14 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("int"); - b.Property("ChildRequestId"); + b.Property("ChildRequestId") + .HasColumnType("int"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("int"); b.HasKey("Id"); @@ -727,47 +966,60 @@ namespace Ombi.Store.Migrations.OmbiMySql modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("Ombi.Store.Entities.OmbiUser") + b.HasOne("Ombi.Store.Entities.OmbiUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("Ombi.Store.Entities.OmbiUser") + b.HasOne("Ombi.Store.Entities.OmbiUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Ombi.Store.Entities.OmbiUser") + b.HasOne("Ombi.Store.Entities.OmbiUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("Ombi.Store.Entities.OmbiUser") + b.HasOne("Ombi.Store.Entities.OmbiUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); }); modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => @@ -796,7 +1048,8 @@ namespace Ombi.Store.Migrations.OmbiMySql b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") .WithMany("ChildRequests") .HasForeignKey("ParentRequestId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") .WithMany() @@ -819,13 +1072,14 @@ namespace Ombi.Store.Migrations.OmbiMySql b.HasOne("Ombi.Store.Entities.Requests.IssueCategory", "IssueCategory") .WithMany() .HasForeignKey("IssueCategoryId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Ombi.Store.Entities.Requests.ChildRequests") + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", null) .WithMany("Issues") .HasForeignKey("IssueId"); - b.HasOne("Ombi.Store.Entities.Requests.MovieRequests") + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", null) .WithMany("Issues") .HasForeignKey("IssueId"); @@ -881,7 +1135,8 @@ namespace Ombi.Store.Migrations.OmbiMySql b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season") .WithMany("Episodes") .HasForeignKey("SeasonId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => @@ -889,7 +1144,8 @@ namespace Ombi.Store.Migrations.OmbiMySql b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") .WithMany("SeasonRequests") .HasForeignKey("ChildRequestId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/src/Ombi.Store/Migrations/OmbiSqlite/20200218231003_MobileDevices.Designer.cs b/src/Ombi.Store/Migrations/OmbiSqlite/20200218231003_MobileDevices.Designer.cs new file mode 100644 index 000000000..08d05fe78 --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiSqlite/20200218231003_MobileDevices.Designer.cs @@ -0,0 +1,1154 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Ombi.Store.Context.Sqlite; + +namespace Ombi.Store.Migrations.OmbiSqlite +{ + [DbContext(typeof(OmbiSqliteContext))] + [Migration("20200218231003_MobileDevices")] + partial class MobileDevices + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT") + .HasMaxLength(256); + + b.Property("NormalizedName") + .HasColumnType("TEXT") + .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() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AuditArea") + .HasColumnType("INTEGER"); + + b.Property("AuditType") + .HasColumnType("INTEGER"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("User") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("MobileDevices"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("NotificationType") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("NotificationTemplates"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("PlayerId") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("NotificationUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("Alias") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasColumnType("TEXT") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("EmbyConnectUserId") + .HasColumnType("TEXT"); + + b.Property("EpisodeRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("LastLoggedIn") + .HasColumnType("TEXT"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("MovieRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("MusicRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("NormalizedEmail") + .HasColumnType("TEXT") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .HasColumnType("TEXT") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("ProviderUserId") + .HasColumnType("TEXT"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserAccessToken") + .HasColumnType("TEXT"); + + b.Property("UserName") + .HasColumnType("TEXT") + .HasMaxLength(256); + + b.Property("UserType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("AlbumId") + .HasColumnType("TEXT"); + + b.Property("ContentId") + .HasColumnType("INTEGER"); + + b.Property("ContentType") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RecentlyAddedLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Completed") + .HasColumnType("TEXT"); + + b.Property("Dts") + .HasColumnType("TEXT"); + + b.Property("Error") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RetryCount") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RequestQueue"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestSubscription"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("ArtistName") + .HasColumnType("TEXT"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Cover") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("Disk") + .HasColumnType("TEXT"); + + b.Property("ForeignAlbumId") + .HasColumnType("TEXT"); + + b.Property("ForeignArtistId") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Rating") + .HasColumnType("TEXT"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("AlbumRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("ParentRequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SeriesType") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ParentRequestId"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("IssueCategory"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("IssuesId") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssuesId"); + + b.HasIndex("UserId"); + + b.ToTable("IssueComments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("IssueCategoryId") + .HasColumnType("INTEGER"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("ProviderId") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("ResovledDate") + .HasColumnType("TEXT"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("UserReportedId") + .HasColumnType("TEXT"); + + 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() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("DigitalReleaseDate") + .HasColumnType("TEXT"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("LangCode") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("RootPathOverride") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("TheMovieDbId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MovieRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EpisodeCount") + .HasColumnType("INTEGER"); + + b.Property("RequestDate") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RootFolder") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("TotalSeasons") + .HasColumnType("INTEGER"); + + b.Property("TvDbId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("TvRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Tokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RadarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("RadarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfileAnime") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPathAnime") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserQualityProfiles"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("Deleted") + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VoteType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Votes"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AirDate") + .HasColumnType("TEXT"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("Requested") + .HasColumnType("INTEGER"); + + b.Property("SeasonId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("SeasonId"); + + b.ToTable("EpisodeRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChildRequestId") + .HasColumnType("INTEGER"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChildRequestId"); + + b.ToTable("SeasonRequests"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("NotificationUserIds") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") + .WithMany("ChildRequests") + .HasForeignKey("ParentRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", null) + .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.Entities.UserNotificationPreferences", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("UserNotificationPreferences") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", 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) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") + .WithMany("SeasonRequests") + .HasForeignKey("ChildRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiSqlite/20200218231003_MobileDevices.cs b/src/Ombi.Store/Migrations/OmbiSqlite/20200218231003_MobileDevices.cs new file mode 100644 index 000000000..142d7dd3c --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiSqlite/20200218231003_MobileDevices.cs @@ -0,0 +1,214 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Ombi.Store.Migrations.OmbiSqlite +{ + public partial class MobileDevices : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "EmbyEpisode"); + + migrationBuilder.DropTable( + name: "PlexEpisode"); + + migrationBuilder.DropTable( + name: "PlexSeasonsContent"); + + migrationBuilder.DropTable( + name: "EmbyContent"); + + migrationBuilder.DropTable( + name: "PlexServerContent"); + + migrationBuilder.AddColumn( + name: "EpisodeNumber", + table: "Issues", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SeasonNumber", + table: "Issues", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "MobileDevices", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Token = table.Column(nullable: true), + UserId = table.Column(nullable: true), + AddedAt = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MobileDevices", x => x.Id); + table.ForeignKey( + name: "FK_MobileDevices_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_MobileDevices_UserId", + table: "MobileDevices", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "MobileDevices"); + + migrationBuilder.DropColumn( + name: "EpisodeNumber", + table: "Issues"); + + migrationBuilder.DropColumn( + name: "SeasonNumber", + table: "Issues"); + + migrationBuilder.CreateTable( + name: "EmbyContent", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AddedAt = table.Column(nullable: false), + EmbyId = table.Column(nullable: false), + ImdbId = table.Column(nullable: true), + ProviderId = table.Column(nullable: true), + TheMovieDbId = table.Column(nullable: true), + Title = table.Column(nullable: true), + TvDbId = table.Column(nullable: true), + Type = table.Column(nullable: false), + Url = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_EmbyContent", x => x.Id); + table.UniqueConstraint("AK_EmbyContent_EmbyId", x => x.EmbyId); + }); + + migrationBuilder.CreateTable( + name: "PlexServerContent", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AddedAt = table.Column(nullable: false), + ImdbId = table.Column(nullable: true), + Key = table.Column(nullable: false), + Quality = table.Column(nullable: true), + ReleaseYear = table.Column(nullable: true), + RequestId = table.Column(nullable: true), + TheMovieDbId = table.Column(nullable: true), + Title = table.Column(nullable: true), + TvDbId = table.Column(nullable: true), + Type = table.Column(nullable: false), + Url = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PlexServerContent", x => x.Id); + table.UniqueConstraint("AK_PlexServerContent_Key", x => x.Key); + }); + + migrationBuilder.CreateTable( + name: "EmbyEpisode", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + AddedAt = table.Column(nullable: false), + EmbyId = table.Column(nullable: true), + EpisodeNumber = table.Column(nullable: false), + ImdbId = table.Column(nullable: true), + ParentId = table.Column(nullable: true), + ProviderId = table.Column(nullable: true), + SeasonNumber = table.Column(nullable: false), + TheMovieDbId = table.Column(nullable: true), + Title = table.Column(nullable: true), + TvDbId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_EmbyEpisode", x => x.Id); + table.ForeignKey( + name: "FK_EmbyEpisode_EmbyContent_ParentId", + column: x => x.ParentId, + principalTable: "EmbyContent", + principalColumn: "EmbyId", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "PlexEpisode", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + EpisodeNumber = table.Column(nullable: false), + GrandparentKey = table.Column(nullable: false), + Key = table.Column(nullable: false), + ParentKey = table.Column(nullable: false), + SeasonNumber = table.Column(nullable: false), + Title = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PlexEpisode", x => x.Id); + table.ForeignKey( + name: "FK_PlexEpisode_PlexServerContent_GrandparentKey", + column: x => x.GrandparentKey, + principalTable: "PlexServerContent", + principalColumn: "Key", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PlexSeasonsContent", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ParentKey = table.Column(nullable: false), + PlexContentId = table.Column(nullable: false), + PlexServerContentId = table.Column(nullable: true), + SeasonKey = table.Column(nullable: false), + SeasonNumber = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PlexSeasonsContent", x => x.Id); + table.ForeignKey( + name: "FK_PlexSeasonsContent_PlexServerContent_PlexServerContentId", + column: x => x.PlexServerContentId, + principalTable: "PlexServerContent", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_EmbyEpisode_ParentId", + table: "EmbyEpisode", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_PlexEpisode_GrandparentKey", + table: "PlexEpisode", + column: "GrandparentKey"); + + migrationBuilder.CreateIndex( + name: "IX_PlexSeasonsContent_PlexServerContentId", + table: "PlexSeasonsContent", + column: "PlexServerContentId"); + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiSqlite/OmbiSqliteContextModelSnapshot.cs b/src/Ombi.Store/Migrations/OmbiSqlite/OmbiSqliteContextModelSnapshot.cs index 271c38300..a33c12fb4 100644 --- a/src/Ombi.Store/Migrations/OmbiSqlite/OmbiSqliteContextModelSnapshot.cs +++ b/src/Ombi.Store/Migrations/OmbiSqlite/OmbiSqliteContextModelSnapshot.cs @@ -3,7 +3,6 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Ombi.Store.Context; using Ombi.Store.Context.Sqlite; namespace Ombi.Store.Migrations.OmbiSqlite @@ -15,20 +14,23 @@ namespace Ombi.Store.Migrations.OmbiSqlite { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079"); + .HasAnnotation("ProductVersion", "3.1.1"); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("TEXT"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Name") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedName") + .HasColumnType("TEXT") .HasMaxLength(256); b.HasKey("Id"); @@ -43,14 +45,18 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("RoleId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -62,14 +68,18 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ClaimType"); + b.Property("ClaimType") + .HasColumnType("TEXT"); - b.Property("ClaimValue"); + b.Property("ClaimValue") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -80,14 +90,18 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.Property("LoginProvider"); + b.Property("LoginProvider") + .HasColumnType("TEXT"); - b.Property("ProviderKey"); + b.Property("ProviderKey") + .HasColumnType("TEXT"); - b.Property("ProviderDisplayName"); + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); b.Property("UserId") - .IsRequired(); + .IsRequired() + .HasColumnType("TEXT"); b.HasKey("LoginProvider", "ProviderKey"); @@ -98,9 +112,11 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("TEXT"); b.HasKey("UserId", "RoleId"); @@ -111,13 +127,17 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("LoginProvider"); + b.Property("LoginProvider") + .HasColumnType("TEXT"); - b.Property("Name"); + b.Property("Name") + .HasColumnType("TEXT"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("TEXT"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -127,98 +147,71 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Audit", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("AuditArea"); + b.Property("AuditArea") + .HasColumnType("INTEGER"); - b.Property("AuditType"); + b.Property("AuditType") + .HasColumnType("INTEGER"); - b.Property("DateTime"); + b.Property("DateTime") + .HasColumnType("TEXT"); - b.Property("Description"); + b.Property("Description") + .HasColumnType("TEXT"); - b.Property("User"); + b.Property("User") + .HasColumnType("TEXT"); b.HasKey("Id"); b.ToTable("Audit"); }); - modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AddedAt"); - - b.Property("EmbyId") - .IsRequired(); - - b.Property("ImdbId"); - - b.Property("ProviderId"); - - b.Property("TheMovieDbId"); - - b.Property("Title"); - - b.Property("TvDbId"); - - b.Property("Type"); - - b.Property("Url"); - - b.HasKey("Id"); - - b.ToTable("EmbyContent"); - }); - - modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b => + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => { b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AddedAt"); - - b.Property("EmbyId"); - - b.Property("EpisodeNumber"); - - b.Property("ImdbId"); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ParentId"); + b.Property("AddedAt") + .HasColumnType("TEXT"); - b.Property("ProviderId"); + b.Property("Token") + .HasColumnType("TEXT"); - b.Property("SeasonNumber"); - - b.Property("TheMovieDbId"); - - b.Property("Title"); - - b.Property("TvDbId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.HasKey("Id"); - b.HasIndex("ParentId"); + b.HasIndex("UserId"); - b.ToTable("EmbyEpisode"); + b.ToTable("MobileDevices"); }); modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Agent"); + b.Property("Agent") + .HasColumnType("INTEGER"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("INTEGER"); - b.Property("Message"); + b.Property("Message") + .HasColumnType("TEXT"); - b.Property("NotificationType"); + b.Property("NotificationType") + .HasColumnType("INTEGER"); - b.Property("Subject"); + b.Property("Subject") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -228,13 +221,17 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("AddedAt"); + b.Property("AddedAt") + .HasColumnType("TEXT"); - b.Property("PlayerId"); + b.Property("PlayerId") + .HasColumnType("TEXT"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -246,58 +243,81 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("TEXT"); - b.Property("AccessFailedCount"); + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); - b.Property("Alias"); + b.Property("Alias") + .HasColumnType("TEXT"); b.Property("ConcurrencyStamp") - .IsConcurrencyToken(); + .IsConcurrencyToken() + .HasColumnType("TEXT"); b.Property("Email") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("EmailConfirmed"); + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); - b.Property("EmbyConnectUserId"); + b.Property("EmbyConnectUserId") + .HasColumnType("TEXT"); - b.Property("EpisodeRequestLimit"); + b.Property("EpisodeRequestLimit") + .HasColumnType("INTEGER"); - b.Property("LastLoggedIn"); + b.Property("LastLoggedIn") + .HasColumnType("TEXT"); - b.Property("LockoutEnabled"); + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("TEXT"); - b.Property("MovieRequestLimit"); + b.Property("MovieRequestLimit") + .HasColumnType("INTEGER"); - b.Property("MusicRequestLimit"); + b.Property("MusicRequestLimit") + .HasColumnType("INTEGER"); b.Property("NormalizedEmail") + .HasColumnType("TEXT") .HasMaxLength(256); b.Property("NormalizedUserName") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("PasswordHash"); + b.Property("PasswordHash") + .HasColumnType("TEXT"); - b.Property("PhoneNumber"); + b.Property("PhoneNumber") + .HasColumnType("TEXT"); - b.Property("PhoneNumberConfirmed"); + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); - b.Property("ProviderUserId"); + b.Property("ProviderUserId") + .HasColumnType("TEXT"); - b.Property("SecurityStamp"); + b.Property("SecurityStamp") + .HasColumnType("TEXT"); - b.Property("TwoFactorEnabled"); + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); - b.Property("UserAccessToken"); + b.Property("UserAccessToken") + .HasColumnType("TEXT"); b.Property("UserName") + .HasColumnType("TEXT") .HasMaxLength(256); - b.Property("UserType"); + b.Property("UserType") + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -311,102 +331,32 @@ namespace Ombi.Store.Migrations.OmbiSqlite 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("RequestId"); - - 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.RecentlyAddedLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("AddedAt"); + b.Property("AddedAt") + .HasColumnType("TEXT"); - b.Property("AlbumId"); + b.Property("AlbumId") + .HasColumnType("TEXT"); - b.Property("ContentId"); + b.Property("ContentId") + .HasColumnType("INTEGER"); - b.Property("ContentType"); + b.Property("ContentType") + .HasColumnType("INTEGER"); - b.Property("EpisodeNumber"); + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); - b.Property("Type"); + b.Property("Type") + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -416,19 +366,26 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Completed"); + b.Property("Completed") + .HasColumnType("TEXT"); - b.Property("Dts"); + b.Property("Dts") + .HasColumnType("TEXT"); - b.Property("Error"); + b.Property("Error") + .HasColumnType("TEXT"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("INTEGER"); - b.Property("RetryCount"); + b.Property("RetryCount") + .HasColumnType("INTEGER"); - b.Property("Type"); + b.Property("Type") + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -438,13 +395,17 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("INTEGER"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("INTEGER"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -456,45 +417,65 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Approved"); + b.Property("Approved") + .HasColumnType("INTEGER"); - b.Property("ArtistName"); + b.Property("ArtistName") + .HasColumnType("TEXT"); - b.Property("Available"); + b.Property("Available") + .HasColumnType("INTEGER"); - b.Property("Cover"); + b.Property("Cover") + .HasColumnType("TEXT"); - b.Property("Denied"); + b.Property("Denied") + .HasColumnType("INTEGER"); - b.Property("DeniedReason"); + b.Property("DeniedReason") + .HasColumnType("TEXT"); - b.Property("Disk"); + b.Property("Disk") + .HasColumnType("TEXT"); - b.Property("ForeignAlbumId"); + b.Property("ForeignAlbumId") + .HasColumnType("TEXT"); - b.Property("ForeignArtistId"); + b.Property("ForeignArtistId") + .HasColumnType("TEXT"); - b.Property("MarkedAsApproved"); + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); - b.Property("MarkedAsAvailable"); + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); - b.Property("MarkedAsDenied"); + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); - b.Property("Rating"); + b.Property("Rating") + .HasColumnType("TEXT"); - b.Property("ReleaseDate"); + b.Property("ReleaseDate") + .HasColumnType("TEXT"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("INTEGER"); - b.Property("RequestedByAlias"); + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); - b.Property("RequestedDate"); + b.Property("RequestedDate") + .HasColumnType("TEXT"); - b.Property("RequestedUserId"); + b.Property("RequestedUserId") + .HasColumnType("TEXT"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -506,37 +487,53 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Approved"); + b.Property("Approved") + .HasColumnType("INTEGER"); - b.Property("Available"); + b.Property("Available") + .HasColumnType("INTEGER"); - b.Property("Denied"); + b.Property("Denied") + .HasColumnType("INTEGER"); - b.Property("DeniedReason"); + b.Property("DeniedReason") + .HasColumnType("TEXT"); - b.Property("IssueId"); + b.Property("IssueId") + .HasColumnType("INTEGER"); - b.Property("MarkedAsApproved"); + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); - b.Property("MarkedAsAvailable"); + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); - b.Property("MarkedAsDenied"); + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); - b.Property("ParentRequestId"); + b.Property("ParentRequestId") + .HasColumnType("INTEGER"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("INTEGER"); - b.Property("RequestedByAlias"); + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); - b.Property("RequestedDate"); + b.Property("RequestedDate") + .HasColumnType("TEXT"); - b.Property("RequestedUserId"); + b.Property("RequestedUserId") + .HasColumnType("TEXT"); - b.Property("SeriesType"); + b.Property("SeriesType") + .HasColumnType("INTEGER"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -550,9 +547,11 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -562,15 +561,20 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Comment"); + b.Property("Comment") + .HasColumnType("TEXT"); - b.Property("Date"); + b.Property("Date") + .HasColumnType("TEXT"); - b.Property("IssuesId"); + b.Property("IssuesId") + .HasColumnType("INTEGER"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -584,29 +588,47 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Description") + .HasColumnType("TEXT"); - b.Property("Description"); + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); - b.Property("IssueCategoryId"); + b.Property("IssueCategoryId") + .HasColumnType("INTEGER"); - b.Property("IssueId"); + b.Property("IssueId") + .HasColumnType("INTEGER"); - b.Property("ProviderId"); + b.Property("ProviderId") + .HasColumnType("TEXT"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("INTEGER"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("INTEGER"); - b.Property("ResovledDate"); + b.Property("ResovledDate") + .HasColumnType("TEXT"); - b.Property("Status"); + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); - b.Property("Subject"); + b.Property("Status") + .HasColumnType("INTEGER"); - b.Property("Title"); + b.Property("Subject") + .HasColumnType("TEXT"); - b.Property("UserReportedId"); + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("UserReportedId") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -622,55 +644,80 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Approved"); + b.Property("Approved") + .HasColumnType("INTEGER"); - b.Property("Available"); + b.Property("Available") + .HasColumnType("INTEGER"); - b.Property("Background"); + b.Property("Background") + .HasColumnType("TEXT"); - b.Property("Denied"); + b.Property("Denied") + .HasColumnType("INTEGER"); - b.Property("DeniedReason"); + b.Property("DeniedReason") + .HasColumnType("TEXT"); - b.Property("DigitalReleaseDate"); + b.Property("DigitalReleaseDate") + .HasColumnType("TEXT"); - b.Property("ImdbId"); + b.Property("ImdbId") + .HasColumnType("TEXT"); - b.Property("IssueId"); + b.Property("IssueId") + .HasColumnType("INTEGER"); - b.Property("LangCode"); + b.Property("LangCode") + .HasColumnType("TEXT"); - b.Property("MarkedAsApproved"); + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); - b.Property("MarkedAsAvailable"); + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); - b.Property("MarkedAsDenied"); + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); - b.Property("Overview"); + b.Property("Overview") + .HasColumnType("TEXT"); - b.Property("PosterPath"); + b.Property("PosterPath") + .HasColumnType("TEXT"); - b.Property("QualityOverride"); + b.Property("QualityOverride") + .HasColumnType("INTEGER"); - b.Property("ReleaseDate"); + b.Property("ReleaseDate") + .HasColumnType("TEXT"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("INTEGER"); - b.Property("RequestedByAlias"); + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); - b.Property("RequestedDate"); + b.Property("RequestedDate") + .HasColumnType("TEXT"); - b.Property("RequestedUserId"); + b.Property("RequestedUserId") + .HasColumnType("TEXT"); - b.Property("RootPathOverride"); + b.Property("RootPathOverride") + .HasColumnType("INTEGER"); - b.Property("Status"); + b.Property("Status") + .HasColumnType("TEXT"); - b.Property("TheMovieDbId"); + b.Property("TheMovieDbId") + .HasColumnType("INTEGER"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -682,17 +729,23 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("EpisodeCount"); + b.Property("EpisodeCount") + .HasColumnType("INTEGER"); - b.Property("RequestDate"); + b.Property("RequestDate") + .HasColumnType("TEXT"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("INTEGER"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("INTEGER"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -704,29 +757,41 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Background"); + b.Property("Background") + .HasColumnType("TEXT"); - b.Property("ImdbId"); + b.Property("ImdbId") + .HasColumnType("TEXT"); - b.Property("Overview"); + b.Property("Overview") + .HasColumnType("TEXT"); - b.Property("PosterPath"); + b.Property("PosterPath") + .HasColumnType("TEXT"); - b.Property("QualityOverride"); + b.Property("QualityOverride") + .HasColumnType("INTEGER"); - b.Property("ReleaseDate"); + b.Property("ReleaseDate") + .HasColumnType("TEXT"); - b.Property("RootFolder"); + b.Property("RootFolder") + .HasColumnType("INTEGER"); - b.Property("Status"); + b.Property("Status") + .HasColumnType("TEXT"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("TEXT"); - b.Property("TotalSeasons"); + b.Property("TotalSeasons") + .HasColumnType("INTEGER"); - b.Property("TvDbId"); + b.Property("TvDbId") + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -736,11 +801,14 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Token"); + b.Property("Token") + .HasColumnType("TEXT"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -752,15 +820,20 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Agent"); + b.Property("Agent") + .HasColumnType("INTEGER"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("INTEGER"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -772,21 +845,29 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("RadarrQualityProfile"); + b.Property("RadarrQualityProfile") + .HasColumnType("INTEGER"); - b.Property("RadarrRootPath"); + b.Property("RadarrRootPath") + .HasColumnType("INTEGER"); - b.Property("SonarrQualityProfile"); + b.Property("SonarrQualityProfile") + .HasColumnType("INTEGER"); - b.Property("SonarrQualityProfileAnime"); + b.Property("SonarrQualityProfileAnime") + .HasColumnType("INTEGER"); - b.Property("SonarrRootPath"); + b.Property("SonarrRootPath") + .HasColumnType("INTEGER"); - b.Property("SonarrRootPathAnime"); + b.Property("SonarrRootPathAnime") + .HasColumnType("INTEGER"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -798,19 +879,26 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Entities.Votes", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("Date"); + b.Property("Date") + .HasColumnType("TEXT"); - b.Property("Deleted"); + b.Property("Deleted") + .HasColumnType("INTEGER"); - b.Property("RequestId"); + b.Property("RequestId") + .HasColumnType("INTEGER"); - b.Property("RequestType"); + b.Property("RequestType") + .HasColumnType("INTEGER"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("TEXT"); - b.Property("VoteType"); + b.Property("VoteType") + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -822,23 +910,32 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("AirDate"); + b.Property("AirDate") + .HasColumnType("TEXT"); - b.Property("Approved"); + b.Property("Approved") + .HasColumnType("INTEGER"); - b.Property("Available"); + b.Property("Available") + .HasColumnType("INTEGER"); - b.Property("EpisodeNumber"); + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); - b.Property("Requested"); + b.Property("Requested") + .HasColumnType("INTEGER"); - b.Property("SeasonId"); + b.Property("SeasonId") + .HasColumnType("INTEGER"); - b.Property("Title"); + b.Property("Title") + .HasColumnType("TEXT"); - b.Property("Url"); + b.Property("Url") + .HasColumnType("TEXT"); b.HasKey("Id"); @@ -850,11 +947,14 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); - b.Property("ChildRequestId"); + b.Property("ChildRequestId") + .HasColumnType("INTEGER"); - b.Property("SeasonNumber"); + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); b.HasKey("Id"); @@ -865,55 +965,60 @@ namespace Ombi.Store.Migrations.OmbiSqlite modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("Ombi.Store.Entities.OmbiUser") + b.HasOne("Ombi.Store.Entities.OmbiUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("Ombi.Store.Entities.OmbiUser") + b.HasOne("Ombi.Store.Entities.OmbiUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Ombi.Store.Entities.OmbiUser") + b.HasOne("Ombi.Store.Entities.OmbiUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("Ombi.Store.Entities.OmbiUser") + b.HasOne("Ombi.Store.Entities.OmbiUser", null) .WithMany() .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); - modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b => + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => { - b.HasOne("Ombi.Store.Entities.EmbyContent", "Series") - .WithMany("Episodes") - .HasForeignKey("ParentId") - .HasPrincipalKey("EmbyId"); + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); }); modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => @@ -923,22 +1028,6 @@ namespace Ombi.Store.Migrations.OmbiSqlite .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.RequestSubscription", b => { b.HasOne("Ombi.Store.Entities.OmbiUser", "User") @@ -958,7 +1047,8 @@ namespace Ombi.Store.Migrations.OmbiSqlite b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") .WithMany("ChildRequests") .HasForeignKey("ParentRequestId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") .WithMany() @@ -981,13 +1071,14 @@ namespace Ombi.Store.Migrations.OmbiSqlite b.HasOne("Ombi.Store.Entities.Requests.IssueCategory", "IssueCategory") .WithMany() .HasForeignKey("IssueCategoryId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Ombi.Store.Entities.Requests.ChildRequests") + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", null) .WithMany("Issues") .HasForeignKey("IssueId"); - b.HasOne("Ombi.Store.Entities.Requests.MovieRequests") + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", null) .WithMany("Issues") .HasForeignKey("IssueId"); @@ -1043,7 +1134,8 @@ namespace Ombi.Store.Migrations.OmbiSqlite b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season") .WithMany("Episodes") .HasForeignKey("SeasonId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => @@ -1051,7 +1143,8 @@ namespace Ombi.Store.Migrations.OmbiSqlite b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") .WithMany("SeasonRequests") .HasForeignKey("ChildRequestId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/src/Ombi/Controllers/V2/MobileController.cs b/src/Ombi/Controllers/V2/MobileController.cs new file mode 100644 index 000000000..be96faa98 --- /dev/null +++ b/src/Ombi/Controllers/V2/MobileController.cs @@ -0,0 +1,60 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Ombi.Core.Authentication; +using Ombi.Models.V2; +using Ombi.Store.Entities; +using Ombi.Store.Repository; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Ombi.Controllers.V2 +{ + [ApiV2] + [Authorize] + [Produces("application/json")] + [ApiController] + public class MobileController : ControllerBase + { + public MobileController(IRepository mobileDevices, OmbiUserManager user) + { + _mobileDevices = mobileDevices; + _userManager = user; + } + + private readonly IRepository _mobileDevices; + private readonly OmbiUserManager _userManager; + + [HttpPost("Notification")] + [ApiExplorerSettings(IgnoreApi = true)] + [ProducesResponseType(400)] + [ProducesResponseType(200)] + public async Task AddNotitficationId([FromBody] MobileNotificationBody body) + { + if (!string.IsNullOrEmpty(body?.Token)) + { + var user = await _userManager.Users.FirstOrDefaultAsync(x => x.UserName.Equals(User.Identity.Name, StringComparison.InvariantCultureIgnoreCase)); + // Check if we already have this notification id + var alreadyExists = await _mobileDevices.GetAll().AnyAsync(x => x.Token == body.Token && x.UserId == user.Id); + + if (alreadyExists) + { + return Ok(); + } + + // let's add it + await _mobileDevices.Add(new MobileDevices + { + Token = body.Token, + UserId = user.Id, + AddedAt = DateTime.Now, + }); + return Ok(); + } + return BadRequest(); + } + } +} diff --git a/src/Ombi/Models/V2/MobileNotificationBody.cs b/src/Ombi/Models/V2/MobileNotificationBody.cs new file mode 100644 index 000000000..c6a361d65 --- /dev/null +++ b/src/Ombi/Models/V2/MobileNotificationBody.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Ombi.Models.V2 +{ + public class MobileNotificationBody + { + public string Token { get; set; } + } +} diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index 2f7c6a346..618032bda 100644 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -63,6 +63,7 @@ namespace Ombi { services.AddIdentity() .AddEntityFrameworkStores() + .AddRoles() .AddDefaultTokenProviders() .AddUserManager();