From 5c848ca01c3104d34470e4a2f8bbadd20ca587d2 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 16 Feb 2021 22:04:51 +0100 Subject: [PATCH] Fixing dotnet-ef types --- Kyoo.Common/Models/Resources/Library.cs | 2 +- Kyoo.Common/Models/Resources/Show.cs | 2 +- Kyoo/Kyoo.csproj | 1 + Kyoo/Models/DatabaseContext.cs | 14 +- ....cs => 20210216205007_Initial.Designer.cs} | 440 ++++++++++++------ ...2_Initial.cs => 20210216205007_Initial.cs} | 426 +++++++++-------- .../ConfigurationDbContextModelSnapshot.cs | 438 +++++++++++------ ....cs => 20210216205030_Initial.Designer.cs} | 117 +++-- ...4_Initial.cs => 20210216205030_Initial.cs} | 130 +++--- .../IdentityDatabaseModelSnapshot.cs | 115 +++-- ....cs => 20210216202218_Initial.Designer.cs} | 128 ++++- ...2_Initial.cs => 20210216202218_Initial.cs} | 216 ++++----- .../Internal/DatabaseContextModelSnapshot.cs | 126 ++++- Kyoo/Models/IdentityDatabase.cs | 1 + Kyoo/Startup.cs | 4 +- Kyoo/Tasks/CreateDatabase.cs | 6 +- 16 files changed, 1371 insertions(+), 795 deletions(-) rename Kyoo/Models/DatabaseMigrations/IdentityConfiguration/{20200526235342_Initial.Designer.cs => 20210216205007_Initial.Designer.cs} (79%) rename Kyoo/Models/DatabaseMigrations/IdentityConfiguration/{20200526235342_Initial.cs => 20210216205007_Initial.cs} (52%) rename Kyoo/Models/DatabaseMigrations/IdentityDatbase/{20200526235424_Initial.Designer.cs => 20210216205030_Initial.Designer.cs} (84%) rename Kyoo/Models/DatabaseMigrations/IdentityDatbase/{20200526235424_Initial.cs => 20210216205030_Initial.cs} (56%) rename Kyoo/Models/DatabaseMigrations/Internal/{20210128212212_Initial.Designer.cs => 20210216202218_Initial.Designer.cs} (87%) rename Kyoo/Models/DatabaseMigrations/Internal/{20210128212212_Initial.cs => 20210216202218_Initial.cs} (73%) diff --git a/Kyoo.Common/Models/Resources/Library.cs b/Kyoo.Common/Models/Resources/Library.cs index de3ea5fc..59e5b01d 100644 --- a/Kyoo.Common/Models/Resources/Library.cs +++ b/Kyoo.Common/Models/Resources/Library.cs @@ -9,7 +9,7 @@ namespace Kyoo.Models [JsonIgnore] public int ID { get; set; } public string Slug { get; set; } public string Name { get; set; } - public ICollection Paths { get; set; } + public string[] Paths { get; set; } [EditableRelation] public virtual ICollection Providers { get; set; } diff --git a/Kyoo.Common/Models/Resources/Show.cs b/Kyoo.Common/Models/Resources/Show.cs index 675f45dc..fadac0bd 100644 --- a/Kyoo.Common/Models/Resources/Show.cs +++ b/Kyoo.Common/Models/Resources/Show.cs @@ -9,7 +9,7 @@ namespace Kyoo.Models public int ID { get; set; } public string Slug { get; set; } public string Title { get; set; } - [EditableRelation] public ICollection Aliases { get; set; } + [EditableRelation] public string[] Aliases { get; set; } [JsonIgnore] public string Path { get; set; } public string Overview { get; set; } public Status? Status { get; set; } diff --git a/Kyoo/Kyoo.csproj b/Kyoo/Kyoo.csproj index 7c15982f..54911115 100644 --- a/Kyoo/Kyoo.csproj +++ b/Kyoo/Kyoo.csproj @@ -105,6 +105,7 @@ + diff --git a/Kyoo/Models/DatabaseContext.cs b/Kyoo/Models/DatabaseContext.cs index 236b82c2..e7470268 100644 --- a/Kyoo/Models/DatabaseContext.cs +++ b/Kyoo/Models/DatabaseContext.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -43,11 +42,6 @@ namespace Kyoo NpgsqlConnection.GlobalTypeMapper.MapEnum(); NpgsqlConnection.GlobalTypeMapper.MapEnum(); } - - private readonly ValueComparer> _stringArrayComparer = new( - (l1, l2) => l1.SequenceEqual(l2), - arr => arr.Aggregate(0, (i, s) => s.GetHashCode()) - ); protected override void OnModelCreating(ModelBuilder modelBuilder) { @@ -61,16 +55,14 @@ namespace Kyoo modelBuilder.Ignore(); modelBuilder.Ignore(); modelBuilder.Ignore(); - + modelBuilder.Entity() .Property(x => x.Paths) - .HasColumnType("text[]") - .Metadata.SetValueComparer(_stringArrayComparer); + .HasColumnType("text[]"); modelBuilder.Entity() .Property(x => x.Aliases) - .HasColumnType("text[]") - .Metadata.SetValueComparer(_stringArrayComparer); + .HasColumnType("text[]"); modelBuilder.Entity() .Property(t => t.IsDefault) diff --git a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.Designer.cs b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20210216205007_Initial.Designer.cs similarity index 79% rename from Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.Designer.cs rename to Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20210216205007_Initial.Designer.cs index 02ebc8c3..87d6032d 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.Designer.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20210216205007_Initial.Designer.cs @@ -10,16 +10,16 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration { [DbContext(typeof(ConfigurationDbContext))] - [Migration("20200526235342_Initial")] + [Migration("20210216205007_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => { @@ -28,16 +28,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + b.Property("Created") .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); b.Property("DisplayName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Enabled") .HasColumnType("boolean"); @@ -47,12 +51,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Name") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("NonEditable") .HasColumnType("boolean"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("boolean"); + b.Property("Updated") .HasColumnType("timestamp without time zone"); @@ -76,14 +83,14 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Type") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("Id"); b.HasIndex("ApiResourceId"); - b.ToTable("ApiClaims"); + b.ToTable("ApiResourceClaims"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => @@ -98,22 +105,22 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Key") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); b.HasIndex("ApiResourceId"); - b.ToTable("ApiProperties"); + b.ToTable("ApiResourceProperties"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -123,21 +130,80 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("ApiResourceId") .HasColumnType("integer"); + b.Property("Scope") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("ApiResourceId"); + + b.ToTable("ApiResourceScopes"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ApiResourceId") + .HasColumnType("integer"); + + b.Property("Created") + .HasColumnType("timestamp without time zone"); + b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("Expiration") + .HasColumnType("timestamp without time zone"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.HasKey("Id"); + + b.HasIndex("ApiResourceId"); + + b.ToTable("ApiResourceSecrets"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); b.Property("DisplayName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Emphasize") .HasColumnType("boolean"); + b.Property("Enabled") + .HasColumnType("boolean"); + b.Property("Name") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Required") .HasColumnType("boolean"); @@ -147,8 +213,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.HasKey("Id"); - b.HasIndex("ApiResourceId"); - b.HasIndex("Name") .IsUnique(); @@ -162,56 +226,46 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - b.Property("ApiScopeId") + b.Property("ScopeId") .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("Id"); - b.HasIndex("ApiScopeId"); + b.HasIndex("ScopeId"); b.ToTable("ApiScopeClaims"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - b.Property("ApiResourceId") - .HasColumnType("integer"); - - b.Property("Created") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); - - b.Property("Expiration") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") + b.Property("Key") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("ScopeId") + .HasColumnType("integer"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(4000)") - .HasMaxLength(4000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); - b.HasIndex("ApiResourceId"); + b.HasIndex("ScopeId"); - b.ToTable("ApiSecrets"); + b.ToTable("ApiScopeProperties"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => @@ -242,6 +296,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("AllowRememberConsent") .HasColumnType("boolean"); + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("boolean"); @@ -255,25 +313,25 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("boolean"); b.Property("BackChannelLogoutUri") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("ClientClaimsPrefix") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientUri") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("ConsentLifetime") .HasColumnType("integer"); @@ -282,8 +340,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); b.Property("DeviceCodeLifetime") .HasColumnType("integer"); @@ -298,8 +356,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("boolean"); b.Property("FrontChannelLogoutUri") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("IdentityTokenLifetime") .HasColumnType("integer"); @@ -311,20 +369,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("LogoUri") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("NonEditable") .HasColumnType("boolean"); b.Property("PairWiseSubjectSalt") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ProtocolType") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("RefreshTokenExpiration") .HasColumnType("integer"); @@ -341,6 +399,9 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("RequirePkce") .HasColumnType("boolean"); + b.Property("RequireRequestObject") + .HasColumnType("boolean"); + b.Property("SlidingRefreshTokenLifetime") .HasColumnType("integer"); @@ -351,8 +412,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("UserCodeType") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("UserSsoLifetime") .HasColumnType("integer"); @@ -377,13 +438,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Type") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.HasKey("Id"); @@ -404,8 +465,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Origin") .IsRequired() - .HasColumnType("character varying(150)") - .HasMaxLength(150); + .HasMaxLength(150) + .HasColumnType("character varying(150)"); b.HasKey("Id"); @@ -426,8 +487,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("GrantType") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.HasKey("Id"); @@ -448,8 +509,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Provider") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("Id"); @@ -470,8 +531,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("PostLogoutRedirectUri") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); @@ -492,13 +553,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Key") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); @@ -519,8 +580,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("RedirectUri") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); @@ -541,8 +602,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Scope") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("Id"); @@ -565,21 +626,21 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("Expiration") .HasColumnType("timestamp without time zone"); b.Property("Type") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); b.HasKey("Id"); @@ -588,28 +649,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.ToTable("ClientSecrets"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("IdentityResourceId") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); - - b.HasKey("Id"); - - b.HasIndex("IdentityResourceId"); - - b.ToTable("IdentityClaims"); - }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => { b.Property("Id") @@ -621,12 +660,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); b.Property("DisplayName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Emphasize") .HasColumnType("boolean"); @@ -636,8 +675,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Name") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("NonEditable") .HasColumnType("boolean"); @@ -659,6 +698,28 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.ToTable("IdentityResources"); }); + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("IdentityResourceId") + .HasColumnType("integer"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("IdentityResourceId"); + + b.ToTable("IdentityResourceClaims"); + }); + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => { b.Property("Id") @@ -671,19 +732,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Key") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); b.HasIndex("IdentityResourceId"); - b.ToTable("IdentityProperties"); + b.ToTable("IdentityResourceProperties"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b => @@ -693,6 +754,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => @@ -702,33 +765,52 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => - { - b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "ApiScope") - .WithMany("UserClaims") - .HasForeignKey("ApiScopeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") .WithMany("Secrets") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => + { + b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope") + .WithMany("UserClaims") + .HasForeignKey("ScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Scope"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b => + { + b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope") + .WithMany("Properties") + .HasForeignKey("ScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Scope"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b => @@ -738,6 +820,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b => @@ -747,6 +831,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b => @@ -756,6 +842,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b => @@ -765,6 +853,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b => @@ -774,6 +864,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b => @@ -783,6 +875,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => @@ -792,6 +886,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b => @@ -801,6 +897,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b => @@ -810,15 +908,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource") .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("IdentityResource"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => @@ -828,6 +930,54 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("IdentityResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("IdentityResource"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); }); #pragma warning restore 612, 618 } diff --git a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.cs b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20210216205007_Initial.cs similarity index 52% rename from Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.cs rename to Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20210216205007_Initial.cs index 447f9385..fec7b0f0 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20210216205007_Initial.cs @@ -12,69 +12,92 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ApiResources", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Enabled = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Created = table.Column(nullable: false), - Updated = table.Column(nullable: true), - LastAccessed = table.Column(nullable: true), - NonEditable = table.Column(nullable: false) + Enabled = table.Column(type: "boolean", nullable: false), + Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + AllowedAccessTokenSigningAlgorithms = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + ShowInDiscoveryDocument = table.Column(type: "boolean", nullable: false), + Created = table.Column(type: "timestamp without time zone", nullable: false), + Updated = table.Column(type: "timestamp without time zone", nullable: true), + LastAccessed = table.Column(type: "timestamp without time zone", nullable: true), + NonEditable = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiResources", x => x.Id); }); + migrationBuilder.CreateTable( + name: "ApiScopes", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Enabled = table.Column(type: "boolean", nullable: false), + Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + Required = table.Column(type: "boolean", nullable: false), + Emphasize = table.Column(type: "boolean", nullable: false), + ShowInDiscoveryDocument = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiScopes", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Clients", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Enabled = table.Column(nullable: false), - ClientId = table.Column(maxLength: 200, nullable: false), - ProtocolType = table.Column(maxLength: 200, nullable: false), - RequireClientSecret = table.Column(nullable: false), - ClientName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), - RequireConsent = table.Column(nullable: false), - AllowRememberConsent = table.Column(nullable: false), - AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), - RequirePkce = table.Column(nullable: false), - AllowPlainTextPkce = table.Column(nullable: false), - AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - BackChannelLogoutSessionRequired = table.Column(nullable: false), - AllowOfflineAccess = table.Column(nullable: false), - IdentityTokenLifetime = table.Column(nullable: false), - AccessTokenLifetime = table.Column(nullable: false), - AuthorizationCodeLifetime = table.Column(nullable: false), - ConsentLifetime = table.Column(nullable: true), - AbsoluteRefreshTokenLifetime = table.Column(nullable: false), - SlidingRefreshTokenLifetime = table.Column(nullable: false), - RefreshTokenUsage = table.Column(nullable: false), - UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), - RefreshTokenExpiration = table.Column(nullable: false), - AccessTokenType = table.Column(nullable: false), - EnableLocalLogin = table.Column(nullable: false), - IncludeJwtId = table.Column(nullable: false), - AlwaysSendClientClaims = table.Column(nullable: false), - ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), - PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), - Created = table.Column(nullable: false), - Updated = table.Column(nullable: true), - LastAccessed = table.Column(nullable: true), - UserSsoLifetime = table.Column(nullable: true), - UserCodeType = table.Column(maxLength: 100, nullable: true), - DeviceCodeLifetime = table.Column(nullable: false), - NonEditable = table.Column(nullable: false) + Enabled = table.Column(type: "boolean", nullable: false), + ClientId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + ProtocolType = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + RequireClientSecret = table.Column(type: "boolean", nullable: false), + ClientName = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + ClientUri = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + LogoUri = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + RequireConsent = table.Column(type: "boolean", nullable: false), + AllowRememberConsent = table.Column(type: "boolean", nullable: false), + AlwaysIncludeUserClaimsInIdToken = table.Column(type: "boolean", nullable: false), + RequirePkce = table.Column(type: "boolean", nullable: false), + AllowPlainTextPkce = table.Column(type: "boolean", nullable: false), + RequireRequestObject = table.Column(type: "boolean", nullable: false), + AllowAccessTokensViaBrowser = table.Column(type: "boolean", nullable: false), + FrontChannelLogoutUri = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + FrontChannelLogoutSessionRequired = table.Column(type: "boolean", nullable: false), + BackChannelLogoutUri = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + BackChannelLogoutSessionRequired = table.Column(type: "boolean", nullable: false), + AllowOfflineAccess = table.Column(type: "boolean", nullable: false), + IdentityTokenLifetime = table.Column(type: "integer", nullable: false), + AllowedIdentityTokenSigningAlgorithms = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + AccessTokenLifetime = table.Column(type: "integer", nullable: false), + AuthorizationCodeLifetime = table.Column(type: "integer", nullable: false), + ConsentLifetime = table.Column(type: "integer", nullable: true), + AbsoluteRefreshTokenLifetime = table.Column(type: "integer", nullable: false), + SlidingRefreshTokenLifetime = table.Column(type: "integer", nullable: false), + RefreshTokenUsage = table.Column(type: "integer", nullable: false), + UpdateAccessTokenClaimsOnRefresh = table.Column(type: "boolean", nullable: false), + RefreshTokenExpiration = table.Column(type: "integer", nullable: false), + AccessTokenType = table.Column(type: "integer", nullable: false), + EnableLocalLogin = table.Column(type: "boolean", nullable: false), + IncludeJwtId = table.Column(type: "boolean", nullable: false), + AlwaysSendClientClaims = table.Column(type: "boolean", nullable: false), + ClientClaimsPrefix = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + PairWiseSubjectSalt = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + Created = table.Column(type: "timestamp without time zone", nullable: false), + Updated = table.Column(type: "timestamp without time zone", nullable: true), + LastAccessed = table.Column(type: "timestamp without time zone", nullable: true), + UserSsoLifetime = table.Column(type: "integer", nullable: true), + UserCodeType = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + DeviceCodeLifetime = table.Column(type: "integer", nullable: false), + NonEditable = table.Column(type: "boolean", nullable: false) }, constraints: table => { @@ -85,18 +108,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "IdentityResources", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Enabled = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - Created = table.Column(nullable: false), - Updated = table.Column(nullable: true), - NonEditable = table.Column(nullable: false) + Enabled = table.Column(type: "boolean", nullable: false), + Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + DisplayName = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + Required = table.Column(type: "boolean", nullable: false), + Emphasize = table.Column(type: "boolean", nullable: false), + ShowInDiscoveryDocument = table.Column(type: "boolean", nullable: false), + Created = table.Column(type: "timestamp without time zone", nullable: false), + Updated = table.Column(type: "timestamp without time zone", nullable: true), + NonEditable = table.Column(type: "boolean", nullable: false) }, constraints: table => { @@ -104,19 +127,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration }); migrationBuilder.CreateTable( - name: "ApiClaims", + name: "ApiResourceClaims", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false) + ApiResourceId = table.Column(type: "integer", nullable: false), + Type = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) }, constraints: table => { - table.PrimaryKey("PK_ApiClaims", x => x.Id); + table.PrimaryKey("PK_ApiResourceClaims", x => x.Id); table.ForeignKey( - name: "FK_ApiClaims_ApiResources_ApiResourceId", + name: "FK_ApiResourceClaims_ApiResources_ApiResourceId", column: x => x.ApiResourceId, principalTable: "ApiResources", principalColumn: "Id", @@ -124,20 +147,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration }); migrationBuilder.CreateTable( - name: "ApiProperties", + name: "ApiResourceProperties", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false), - ApiResourceId = table.Column(nullable: false) + ApiResourceId = table.Column(type: "integer", nullable: false), + Key = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false) }, constraints: table => { - table.PrimaryKey("PK_ApiProperties", x => x.Id); + table.PrimaryKey("PK_ApiResourceProperties", x => x.Id); table.ForeignKey( - name: "FK_ApiProperties_ApiResources_ApiResourceId", + name: "FK_ApiResourceProperties_ApiResources_ApiResourceId", column: x => x.ApiResourceId, principalTable: "ApiResources", principalColumn: "Id", @@ -145,24 +168,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration }); migrationBuilder.CreateTable( - name: "ApiScopes", + name: "ApiResourceScopes", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - ApiResourceId = table.Column(nullable: false) + Scope = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + ApiResourceId = table.Column(type: "integer", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_ApiScopes", x => x.Id); + table.PrimaryKey("PK_ApiResourceScopes", x => x.Id); table.ForeignKey( - name: "FK_ApiScopes_ApiResources_ApiResourceId", + name: "FK_ApiResourceScopes_ApiResources_ApiResourceId", column: x => x.ApiResourceId, principalTable: "ApiResources", principalColumn: "Id", @@ -170,38 +188,79 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration }); migrationBuilder.CreateTable( - name: "ApiSecrets", + name: "ApiResourceSecrets", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Description = table.Column(maxLength: 1000, nullable: true), - Value = table.Column(maxLength: 4000, nullable: false), - Expiration = table.Column(nullable: true), - Type = table.Column(maxLength: 250, nullable: false), - Created = table.Column(nullable: false), - ApiResourceId = table.Column(nullable: false) + ApiResourceId = table.Column(type: "integer", nullable: false), + Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + Value = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: false), + Expiration = table.Column(type: "timestamp without time zone", nullable: true), + Type = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + Created = table.Column(type: "timestamp without time zone", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_ApiSecrets", x => x.Id); + table.PrimaryKey("PK_ApiResourceSecrets", x => x.Id); table.ForeignKey( - name: "FK_ApiSecrets_ApiResources_ApiResourceId", + name: "FK_ApiResourceSecrets_ApiResources_ApiResourceId", column: x => x.ApiResourceId, principalTable: "ApiResources", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "ApiScopeClaims", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ScopeId = table.Column(type: "integer", nullable: false), + Type = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiScopeClaims", x => x.Id); + table.ForeignKey( + name: "FK_ApiScopeClaims_ApiScopes_ScopeId", + column: x => x.ScopeId, + principalTable: "ApiScopes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ApiScopeProperties", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ScopeId = table.Column(type: "integer", nullable: false), + Key = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApiScopeProperties", x => x.Id); + table.ForeignKey( + name: "FK_ApiScopeProperties_ApiScopes_ScopeId", + column: x => x.ScopeId, + principalTable: "ApiScopes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "ClientClaims", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 250, nullable: false), - ClientId = table.Column(nullable: false) + Type = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + ClientId = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -218,10 +277,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientCorsOrigins", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Origin = table.Column(maxLength: 150, nullable: false), - ClientId = table.Column(nullable: false) + Origin = table.Column(type: "character varying(150)", maxLength: 150, nullable: false), + ClientId = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -238,10 +297,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientGrantTypes", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - GrantType = table.Column(maxLength: 250, nullable: false), - ClientId = table.Column(nullable: false) + GrantType = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + ClientId = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -258,10 +317,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientIdPRestrictions", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Provider = table.Column(maxLength: 200, nullable: false), - ClientId = table.Column(nullable: false) + Provider = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + ClientId = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -278,10 +337,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientPostLogoutRedirectUris", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false), - ClientId = table.Column(nullable: false) + PostLogoutRedirectUri = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false), + ClientId = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -298,11 +357,11 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientProperties", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false), - ClientId = table.Column(nullable: false) + ClientId = table.Column(type: "integer", nullable: false), + Key = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false) }, constraints: table => { @@ -319,10 +378,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientRedirectUris", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RedirectUri = table.Column(maxLength: 2000, nullable: false), - ClientId = table.Column(nullable: false) + RedirectUri = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false), + ClientId = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -339,10 +398,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientScopes", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Scope = table.Column(maxLength: 200, nullable: false), - ClientId = table.Column(nullable: false) + Scope = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + ClientId = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -359,14 +418,14 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientSecrets", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Description = table.Column(maxLength: 2000, nullable: true), - Value = table.Column(maxLength: 4000, nullable: false), - Expiration = table.Column(nullable: true), - Type = table.Column(maxLength: 250, nullable: false), - Created = table.Column(nullable: false), - ClientId = table.Column(nullable: false) + ClientId = table.Column(type: "integer", nullable: false), + Description = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + Value = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: false), + Expiration = table.Column(type: "timestamp without time zone", nullable: true), + Type = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + Created = table.Column(type: "timestamp without time zone", nullable: false) }, constraints: table => { @@ -380,19 +439,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration }); migrationBuilder.CreateTable( - name: "IdentityClaims", + name: "IdentityResourceClaims", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Type = table.Column(maxLength: 200, nullable: false), - IdentityResourceId = table.Column(nullable: false) + IdentityResourceId = table.Column(type: "integer", nullable: false), + Type = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) }, constraints: table => { - table.PrimaryKey("PK_IdentityClaims", x => x.Id); + table.PrimaryKey("PK_IdentityResourceClaims", x => x.Id); table.ForeignKey( - name: "FK_IdentityClaims_IdentityResources_IdentityResourceId", + name: "FK_IdentityResourceClaims_IdentityResources_IdentityResourceId", column: x => x.IdentityResourceId, principalTable: "IdentityResources", principalColumn: "Id", @@ -400,54 +459,34 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration }); migrationBuilder.CreateTable( - name: "IdentityProperties", + name: "IdentityResourceProperties", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false), - IdentityResourceId = table.Column(nullable: false) + IdentityResourceId = table.Column(type: "integer", nullable: false), + Key = table.Column(type: "character varying(250)", maxLength: 250, nullable: false), + Value = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: false) }, constraints: table => { - table.PrimaryKey("PK_IdentityProperties", x => x.Id); + table.PrimaryKey("PK_IdentityResourceProperties", x => x.Id); table.ForeignKey( - name: "FK_IdentityProperties_IdentityResources_IdentityResourceId", + name: "FK_IdentityResourceProperties_IdentityResources_IdentityResour~", column: x => x.IdentityResourceId, principalTable: "IdentityResources", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "ApiScopeClaims", - columns: table => new - { - Id = table.Column(nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Type = table.Column(maxLength: 200, nullable: false), - ApiScopeId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ApiScopeClaims", x => x.Id); - table.ForeignKey( - name: "FK_ApiScopeClaims_ApiScopes_ApiScopeId", - column: x => x.ApiScopeId, - principalTable: "ApiScopes", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateIndex( - name: "IX_ApiClaims_ApiResourceId", - table: "ApiClaims", + name: "IX_ApiResourceClaims_ApiResourceId", + table: "ApiResourceClaims", column: "ApiResourceId"); migrationBuilder.CreateIndex( - name: "IX_ApiProperties_ApiResourceId", - table: "ApiProperties", + name: "IX_ApiResourceProperties_ApiResourceId", + table: "ApiResourceProperties", column: "ApiResourceId"); migrationBuilder.CreateIndex( @@ -457,26 +496,31 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration unique: true); migrationBuilder.CreateIndex( - name: "IX_ApiScopeClaims_ApiScopeId", - table: "ApiScopeClaims", - column: "ApiScopeId"); + name: "IX_ApiResourceScopes_ApiResourceId", + table: "ApiResourceScopes", + column: "ApiResourceId"); migrationBuilder.CreateIndex( - name: "IX_ApiScopes_ApiResourceId", - table: "ApiScopes", + name: "IX_ApiResourceSecrets_ApiResourceId", + table: "ApiResourceSecrets", column: "ApiResourceId"); + migrationBuilder.CreateIndex( + name: "IX_ApiScopeClaims_ScopeId", + table: "ApiScopeClaims", + column: "ScopeId"); + + migrationBuilder.CreateIndex( + name: "IX_ApiScopeProperties_ScopeId", + table: "ApiScopeProperties", + column: "ScopeId"); + migrationBuilder.CreateIndex( name: "IX_ApiScopes_Name", table: "ApiScopes", column: "Name", unique: true); - migrationBuilder.CreateIndex( - name: "IX_ApiSecrets_ApiResourceId", - table: "ApiSecrets", - column: "ApiResourceId"); - migrationBuilder.CreateIndex( name: "IX_ClientClaims_ClientId", table: "ClientClaims", @@ -529,13 +573,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration column: "ClientId"); migrationBuilder.CreateIndex( - name: "IX_IdentityClaims_IdentityResourceId", - table: "IdentityClaims", + name: "IX_IdentityResourceClaims_IdentityResourceId", + table: "IdentityResourceClaims", column: "IdentityResourceId"); migrationBuilder.CreateIndex( - name: "IX_IdentityProperties_IdentityResourceId", - table: "IdentityProperties", + name: "IX_IdentityResourceProperties_IdentityResourceId", + table: "IdentityResourceProperties", column: "IdentityResourceId"); migrationBuilder.CreateIndex( @@ -548,16 +592,22 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "ApiClaims"); + name: "ApiResourceClaims"); migrationBuilder.DropTable( - name: "ApiProperties"); + name: "ApiResourceProperties"); + + migrationBuilder.DropTable( + name: "ApiResourceScopes"); + + migrationBuilder.DropTable( + name: "ApiResourceSecrets"); migrationBuilder.DropTable( name: "ApiScopeClaims"); migrationBuilder.DropTable( - name: "ApiSecrets"); + name: "ApiScopeProperties"); migrationBuilder.DropTable( name: "ClientClaims"); @@ -587,10 +637,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration name: "ClientSecrets"); migrationBuilder.DropTable( - name: "IdentityClaims"); + name: "IdentityResourceClaims"); migrationBuilder.DropTable( - name: "IdentityProperties"); + name: "IdentityResourceProperties"); + + migrationBuilder.DropTable( + name: "ApiResources"); migrationBuilder.DropTable( name: "ApiScopes"); @@ -600,9 +653,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration migrationBuilder.DropTable( name: "IdentityResources"); - - migrationBuilder.DropTable( - name: "ApiResources"); } } } diff --git a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/ConfigurationDbContextModelSnapshot.cs b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/ConfigurationDbContextModelSnapshot.cs index f83d80e5..c11ac33a 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/ConfigurationDbContextModelSnapshot.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/ConfigurationDbContextModelSnapshot.cs @@ -15,9 +15,9 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => { @@ -26,16 +26,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + b.Property("Created") .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); b.Property("DisplayName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Enabled") .HasColumnType("boolean"); @@ -45,12 +49,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Name") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("NonEditable") .HasColumnType("boolean"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("boolean"); + b.Property("Updated") .HasColumnType("timestamp without time zone"); @@ -74,14 +81,14 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Type") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("Id"); b.HasIndex("ApiResourceId"); - b.ToTable("ApiClaims"); + b.ToTable("ApiResourceClaims"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => @@ -96,22 +103,22 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Key") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); b.HasIndex("ApiResourceId"); - b.ToTable("ApiProperties"); + b.ToTable("ApiResourceProperties"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -121,21 +128,80 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("ApiResourceId") .HasColumnType("integer"); + b.Property("Scope") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("ApiResourceId"); + + b.ToTable("ApiResourceScopes"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ApiResourceId") + .HasColumnType("integer"); + + b.Property("Created") + .HasColumnType("timestamp without time zone"); + b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("Expiration") + .HasColumnType("timestamp without time zone"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.HasKey("Id"); + + b.HasIndex("ApiResourceId"); + + b.ToTable("ApiResourceSecrets"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); b.Property("DisplayName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Emphasize") .HasColumnType("boolean"); + b.Property("Enabled") + .HasColumnType("boolean"); + b.Property("Name") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Required") .HasColumnType("boolean"); @@ -145,8 +211,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.HasKey("Id"); - b.HasIndex("ApiResourceId"); - b.HasIndex("Name") .IsUnique(); @@ -160,56 +224,46 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - b.Property("ApiScopeId") + b.Property("ScopeId") .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("Id"); - b.HasIndex("ApiScopeId"); + b.HasIndex("ScopeId"); b.ToTable("ApiScopeClaims"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - b.Property("ApiResourceId") - .HasColumnType("integer"); - - b.Property("Created") - .HasColumnType("timestamp without time zone"); - - b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); - - b.Property("Expiration") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") + b.Property("Key") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("ScopeId") + .HasColumnType("integer"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(4000)") - .HasMaxLength(4000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); - b.HasIndex("ApiResourceId"); + b.HasIndex("ScopeId"); - b.ToTable("ApiSecrets"); + b.ToTable("ApiScopeProperties"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => @@ -240,6 +294,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("AllowRememberConsent") .HasColumnType("boolean"); + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + b.Property("AlwaysIncludeUserClaimsInIdToken") .HasColumnType("boolean"); @@ -253,25 +311,25 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("boolean"); b.Property("BackChannelLogoutUri") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("ClientClaimsPrefix") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientUri") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("ConsentLifetime") .HasColumnType("integer"); @@ -280,8 +338,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); b.Property("DeviceCodeLifetime") .HasColumnType("integer"); @@ -296,8 +354,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("boolean"); b.Property("FrontChannelLogoutUri") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("IdentityTokenLifetime") .HasColumnType("integer"); @@ -309,20 +367,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("LogoUri") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("NonEditable") .HasColumnType("boolean"); b.Property("PairWiseSubjectSalt") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ProtocolType") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("RefreshTokenExpiration") .HasColumnType("integer"); @@ -339,6 +397,9 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("RequirePkce") .HasColumnType("boolean"); + b.Property("RequireRequestObject") + .HasColumnType("boolean"); + b.Property("SlidingRefreshTokenLifetime") .HasColumnType("integer"); @@ -349,8 +410,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("UserCodeType") - .HasColumnType("character varying(100)") - .HasMaxLength(100); + .HasMaxLength(100) + .HasColumnType("character varying(100)"); b.Property("UserSsoLifetime") .HasColumnType("integer"); @@ -375,13 +436,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Type") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.HasKey("Id"); @@ -402,8 +463,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Origin") .IsRequired() - .HasColumnType("character varying(150)") - .HasMaxLength(150); + .HasMaxLength(150) + .HasColumnType("character varying(150)"); b.HasKey("Id"); @@ -424,8 +485,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("GrantType") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.HasKey("Id"); @@ -446,8 +507,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Provider") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("Id"); @@ -468,8 +529,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("PostLogoutRedirectUri") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); @@ -490,13 +551,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Key") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); @@ -517,8 +578,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("RedirectUri") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); @@ -539,8 +600,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Scope") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("Id"); @@ -563,21 +624,21 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.Property("Expiration") .HasColumnType("timestamp without time zone"); b.Property("Type") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(4000)") - .HasMaxLength(4000); + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); b.HasKey("Id"); @@ -586,28 +647,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.ToTable("ClientSecrets"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - - b.Property("IdentityResourceId") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); - - b.HasKey("Id"); - - b.HasIndex("IdentityResourceId"); - - b.ToTable("IdentityClaims"); - }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => { b.Property("Id") @@ -619,12 +658,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("character varying(1000)") - .HasMaxLength(1000); + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); b.Property("DisplayName") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Emphasize") .HasColumnType("boolean"); @@ -634,8 +673,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Name") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("NonEditable") .HasColumnType("boolean"); @@ -657,6 +696,28 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.ToTable("IdentityResources"); }); + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("IdentityResourceId") + .HasColumnType("integer"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("IdentityResourceId"); + + b.ToTable("IdentityResourceClaims"); + }); + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => { b.Property("Id") @@ -669,19 +730,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration b.Property("Key") .IsRequired() - .HasColumnType("character varying(250)") - .HasMaxLength(250); + .HasMaxLength(250) + .HasColumnType("character varying(250)"); b.Property("Value") .IsRequired() - .HasColumnType("character varying(2000)") - .HasMaxLength(2000); + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); b.HasKey("Id"); b.HasIndex("IdentityResourceId"); - b.ToTable("IdentityProperties"); + b.ToTable("IdentityResourceProperties"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b => @@ -691,6 +752,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => @@ -700,33 +763,52 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") .WithMany("Scopes") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => - { - b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "ApiScope") - .WithMany("UserClaims") - .HasForeignKey("ApiScopeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") .WithMany("Secrets") .HasForeignKey("ApiResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("ApiResource"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => + { + b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope") + .WithMany("UserClaims") + .HasForeignKey("ScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Scope"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b => + { + b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope") + .WithMany("Properties") + .HasForeignKey("ScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Scope"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b => @@ -736,6 +818,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b => @@ -745,6 +829,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b => @@ -754,6 +840,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b => @@ -763,6 +851,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b => @@ -772,6 +862,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b => @@ -781,6 +873,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => @@ -790,6 +884,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b => @@ -799,6 +895,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b => @@ -808,15 +906,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("ClientId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Client"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b => { b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource") .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("IdentityResource"); }); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => @@ -826,6 +928,54 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration .HasForeignKey("IdentityResourceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("IdentityResource"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); }); #pragma warning restore 612, 618 } diff --git a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.Designer.cs b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20210216205030_Initial.Designer.cs similarity index 84% rename from Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.Designer.cs rename to Kyoo/Models/DatabaseMigrations/IdentityDatbase/20210216205030_Initial.Designer.cs index ced0460b..10626a22 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.Designer.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20210216205030_Initial.Designer.cs @@ -7,51 +7,59 @@ using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase +namespace Kyoo.Kyoo.Models.DatabaseMigrations.IdentityDatbase { [DbContext(typeof(IdentityDatabase))] - [Migration("20200526235424_Initial")] + [Migration("20210216205030_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("CreationTime") .HasColumnType("timestamp without time zone"); b.Property("Data") .IsRequired() - .HasColumnType("character varying(50000)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("character varying(50000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("DeviceCode") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Expiration") .IsRequired() .HasColumnType("timestamp without time zone"); + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + b.Property("SubjectId") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("UserCode"); @@ -66,33 +74,44 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConsumedTime") + .HasColumnType("timestamp without time zone"); b.Property("CreationTime") .HasColumnType("timestamp without time zone"); b.Property("Data") .IsRequired() - .HasColumnType("character varying(50000)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("character varying(50000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Expiration") .HasColumnType("timestamp without time zone"); + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + b.Property("SubjectId") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Type") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.HasKey("Key"); @@ -100,6 +119,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "SessionId", "Type"); + b.ToTable("PersistedGrants"); }); @@ -116,8 +137,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("text"); b.Property("Email") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("EmailConfirmed") .HasColumnType("boolean"); @@ -129,12 +150,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("timestamp with time zone"); b.Property("NormalizedEmail") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("NormalizedUserName") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("OTAC") .HasColumnType("text"); @@ -158,17 +179,17 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("boolean"); b.Property("UserName") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.HasKey("Id"); b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); + .HasDatabaseName("EmailIndex"); b.HasIndex("NormalizedUserName") .IsUnique() - .HasName("UserNameIndex"); + .HasDatabaseName("UserNameIndex"); b.ToTable("User"); }); @@ -183,18 +204,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("text"); b.Property("Name") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("NormalizedName") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.HasKey("Id"); b.HasIndex("NormalizedName") .IsUnique() - .HasName("RoleNameIndex"); + .HasDatabaseName("RoleNameIndex"); b.ToTable("UserRoles"); }); @@ -250,12 +271,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("character varying(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("ProviderKey") - .HasColumnType("character varying(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("ProviderDisplayName") .HasColumnType("text"); @@ -292,12 +313,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("text"); b.Property("LoginProvider") - .HasColumnType("character varying(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("Name") - .HasColumnType("character varying(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("Value") .HasColumnType("text"); diff --git a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.cs b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20210216205030_Initial.cs similarity index 56% rename from Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.cs rename to Kyoo/Models/DatabaseMigrations/IdentityDatbase/20210216205030_Initial.cs index 15abc8d3..e0cffa4f 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20210216205030_Initial.cs @@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase +namespace Kyoo.Kyoo.Models.DatabaseMigrations.IdentityDatbase { public partial class Initial : Migration { @@ -12,13 +12,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase name: "DeviceCodes", columns: table => new { - UserCode = table.Column(maxLength: 200, nullable: false), - DeviceCode = table.Column(maxLength: 200, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: false), - Data = table.Column(maxLength: 50000, nullable: false) + UserCode = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + DeviceCode = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + SubjectId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + CreationTime = table.Column(type: "timestamp without time zone", nullable: false), + Expiration = table.Column(type: "timestamp without time zone", nullable: false), + Data = table.Column(type: "character varying(50000)", maxLength: 50000, nullable: false) }, constraints: table => { @@ -29,13 +31,16 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase name: "PersistedGrants", columns: table => new { - Key = table.Column(maxLength: 200, nullable: false), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - Data = table.Column(maxLength: 50000, nullable: false) + Key = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + Type = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + SubjectId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + SessionId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + ClientId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + CreationTime = table.Column(type: "timestamp without time zone", nullable: false), + Expiration = table.Column(type: "timestamp without time zone", nullable: true), + ConsumedTime = table.Column(type: "timestamp without time zone", nullable: true), + Data = table.Column(type: "character varying(50000)", maxLength: 50000, nullable: false) }, constraints: table => { @@ -46,23 +51,23 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase name: "User", columns: table => new { - Id = table.Column(nullable: false), - UserName = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - SecurityStamp = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - TwoFactorEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false), - AccessFailedCount = table.Column(nullable: false), - OTAC = table.Column(nullable: true), - OTACExpires = table.Column(nullable: true) + Id = table.Column(type: "text", nullable: false), + OTAC = table.Column(type: "text", nullable: true), + OTACExpires = table.Column(type: "timestamp without time zone", nullable: true), + UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "boolean", nullable: false), + PasswordHash = table.Column(type: "text", nullable: true), + SecurityStamp = table.Column(type: "text", nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true), + PhoneNumber = table.Column(type: "text", nullable: true), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), + LockoutEnabled = table.Column(type: "boolean", nullable: false), + AccessFailedCount = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -73,10 +78,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase name: "UserRoles", columns: table => new { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(nullable: true) + Id = table.Column(type: "text", nullable: false), + Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -87,11 +92,11 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase name: "UserClaim", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - UserId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) + UserId = table.Column(type: "text", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -108,10 +113,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase name: "UserLogin", columns: table => new { - LoginProvider = table.Column(maxLength: 128, nullable: false), - ProviderKey = table.Column(maxLength: 128, nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(nullable: false) + LoginProvider = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + ProviderKey = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + ProviderDisplayName = table.Column(type: "text", nullable: true), + UserId = table.Column(type: "text", nullable: false) }, constraints: table => { @@ -128,10 +133,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase name: "UserToken", columns: table => new { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 128, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(nullable: true) + UserId = table.Column(type: "text", nullable: false), + LoginProvider = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + Name = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + Value = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -148,35 +153,35 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase name: "UserRole", columns: table => new { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false) + UserId = table.Column(type: "text", nullable: false), + RoleId = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserRole", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_UserRole_UserRoles_RoleId", - column: x => x.RoleId, - principalTable: "UserRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UserRole_User_UserId", column: x => x.UserId, principalTable: "User", principalColumn: "Id", onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_UserRole_UserRoles_RoleId", + column: x => x.RoleId, + principalTable: "UserRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserRoleClaim", columns: table => new { - Id = table.Column(nullable: false) + Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RoleId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) + RoleId = table.Column(type: "text", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -210,6 +215,11 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase table: "PersistedGrants", columns: new[] { "SubjectId", "ClientId", "Type" }); + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_SessionId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); + migrationBuilder.CreateIndex( name: "EmailIndex", table: "User", diff --git a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/IdentityDatabaseModelSnapshot.cs b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/IdentityDatabaseModelSnapshot.cs index 995c15db..fa2da994 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/IdentityDatabaseModelSnapshot.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/IdentityDatabaseModelSnapshot.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase +namespace Kyoo.Kyoo.Models.DatabaseMigrations.IdentityDatbase { [DbContext(typeof(IdentityDatabase))] partial class IdentityDatabaseModelSnapshot : ModelSnapshot @@ -15,41 +15,49 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property("UserCode") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("CreationTime") .HasColumnType("timestamp without time zone"); b.Property("Data") .IsRequired() - .HasColumnType("character varying(50000)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("character varying(50000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("DeviceCode") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Expiration") .IsRequired() .HasColumnType("timestamp without time zone"); + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + b.Property("SubjectId") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.HasKey("UserCode"); @@ -64,33 +72,44 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => { b.Property("Key") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("ClientId") .IsRequired() - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("ConsumedTime") + .HasColumnType("timestamp without time zone"); b.Property("CreationTime") .HasColumnType("timestamp without time zone"); b.Property("Data") .IsRequired() - .HasColumnType("character varying(50000)") - .HasMaxLength(50000); + .HasMaxLength(50000) + .HasColumnType("character varying(50000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Expiration") .HasColumnType("timestamp without time zone"); + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + b.Property("SubjectId") - .HasColumnType("character varying(200)") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("character varying(200)"); b.Property("Type") .IsRequired() - .HasColumnType("character varying(50)") - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("character varying(50)"); b.HasKey("Key"); @@ -98,6 +117,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "SessionId", "Type"); + b.ToTable("PersistedGrants"); }); @@ -114,8 +135,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("text"); b.Property("Email") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("EmailConfirmed") .HasColumnType("boolean"); @@ -127,12 +148,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("timestamp with time zone"); b.Property("NormalizedEmail") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("NormalizedUserName") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("OTAC") .HasColumnType("text"); @@ -156,17 +177,17 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("boolean"); b.Property("UserName") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.HasKey("Id"); b.HasIndex("NormalizedEmail") - .HasName("EmailIndex"); + .HasDatabaseName("EmailIndex"); b.HasIndex("NormalizedUserName") .IsUnique() - .HasName("UserNameIndex"); + .HasDatabaseName("UserNameIndex"); b.ToTable("User"); }); @@ -181,18 +202,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("text"); b.Property("Name") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.Property("NormalizedName") - .HasColumnType("character varying(256)") - .HasMaxLength(256); + .HasMaxLength(256) + .HasColumnType("character varying(256)"); b.HasKey("Id"); b.HasIndex("NormalizedName") .IsUnique() - .HasName("RoleNameIndex"); + .HasDatabaseName("RoleNameIndex"); b.ToTable("UserRoles"); }); @@ -248,12 +269,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("character varying(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("ProviderKey") - .HasColumnType("character varying(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("ProviderDisplayName") .HasColumnType("text"); @@ -290,12 +311,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase .HasColumnType("text"); b.Property("LoginProvider") - .HasColumnType("character varying(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("Name") - .HasColumnType("character varying(128)") - .HasMaxLength(128); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("Value") .HasColumnType("text"); diff --git a/Kyoo/Models/DatabaseMigrations/Internal/20210128212212_Initial.Designer.cs b/Kyoo/Models/DatabaseMigrations/Internal/20210216202218_Initial.Designer.cs similarity index 87% rename from Kyoo/Models/DatabaseMigrations/Internal/20210128212212_Initial.Designer.cs rename to Kyoo/Models/DatabaseMigrations/Internal/20210216202218_Initial.Designer.cs index e9e02cef..ece1dce0 100644 --- a/Kyoo/Models/DatabaseMigrations/Internal/20210128212212_Initial.Designer.cs +++ b/Kyoo/Models/DatabaseMigrations/Internal/20210216202218_Initial.Designer.cs @@ -1,6 +1,5 @@ // using System; -using System.Collections.Generic; using Kyoo; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; @@ -8,22 +7,22 @@ using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Kyoo.Models.DatabaseMigrations.Internal +namespace Kyoo.Kyoo.Models.DatabaseMigrations.Internal { [DbContext(typeof(DatabaseContext))] - [Migration("20210128212212_Initial")] + [Migration("20210216202218_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Npgsql:Enum:item_type", "show,movie,collection") - .HasAnnotation("Npgsql:Enum:status", "finished,airing,planned,unknown") - .HasAnnotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,font") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" }) + .HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" }) + .HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "font" }) + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); modelBuilder.Entity("Kyoo.Models.CollectionDE", b => { @@ -51,8 +50,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .IsUnique(); b.ToTable("Collections"); - - b.HasDiscriminator(); }); modelBuilder.Entity("Kyoo.Models.CollectionLink", b => @@ -140,8 +137,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .IsUnique(); b.ToTable("Genres"); - - b.HasDiscriminator(); }); modelBuilder.Entity("Kyoo.Models.GenreLink", b => @@ -169,7 +164,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal b.Property("Name") .HasColumnType("text"); - b.Property>("Paths") + b.Property("Paths") .HasColumnType("text[]"); b.Property("Slug") @@ -182,8 +177,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .IsUnique(); b.ToTable("Libraries"); - - b.HasDiscriminator(); }); modelBuilder.Entity("Kyoo.Models.LibraryLink", b => @@ -393,7 +386,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - b.Property>("Aliases") + b.Property("Aliases") .HasColumnType("text[]"); b.Property("Backdrop") @@ -444,8 +437,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal b.HasIndex("StudioID"); b.ToTable("Shows"); - - b.HasDiscriminator(); }); modelBuilder.Entity("Kyoo.Models.Studio", b => @@ -524,6 +515,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ParentID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Child"); + + b.Navigation("Parent"); }); modelBuilder.Entity("Kyoo.Models.Episode", b => @@ -537,6 +532,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Season"); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.GenreLink", b => @@ -552,6 +551,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ParentID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Child"); + + b.Navigation("Parent"); }); modelBuilder.Entity("Kyoo.Models.LibraryLink", b => @@ -571,6 +574,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .WithMany("LibraryLinks") .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Collection"); + + b.Navigation("Library"); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.MetadataID", b => @@ -600,6 +609,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .WithMany("ExternalIDs") .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Episode"); + + b.Navigation("People"); + + b.Navigation("Provider"); + + b.Navigation("Season"); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.PeopleRole", b => @@ -615,6 +634,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("People"); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.ProviderLink", b => @@ -630,6 +653,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ParentID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Child"); + + b.Navigation("Parent"); }); modelBuilder.Entity("Kyoo.Models.Season", b => @@ -639,6 +666,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.ShowDE", b => @@ -646,6 +675,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal b.HasOne("Kyoo.Models.Studio", "Studio") .WithMany() .HasForeignKey("StudioID"); + + b.Navigation("Studio"); }); modelBuilder.Entity("Kyoo.Models.Track", b => @@ -655,6 +686,65 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("EpisodeID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Episode"); + }); + + modelBuilder.Entity("Kyoo.Models.CollectionDE", b => + { + b.Navigation("LibraryLinks"); + + b.Navigation("Links"); + }); + + modelBuilder.Entity("Kyoo.Models.Episode", b => + { + b.Navigation("ExternalIDs"); + + b.Navigation("Tracks"); + }); + + modelBuilder.Entity("Kyoo.Models.GenreDE", b => + { + b.Navigation("Links"); + }); + + modelBuilder.Entity("Kyoo.Models.LibraryDE", b => + { + b.Navigation("Links"); + + b.Navigation("ProviderLinks"); + }); + + modelBuilder.Entity("Kyoo.Models.People", b => + { + b.Navigation("ExternalIDs"); + + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Kyoo.Models.Season", b => + { + b.Navigation("Episodes"); + + b.Navigation("ExternalIDs"); + }); + + modelBuilder.Entity("Kyoo.Models.ShowDE", b => + { + b.Navigation("CollectionLinks"); + + b.Navigation("Episodes"); + + b.Navigation("ExternalIDs"); + + b.Navigation("GenreLinks"); + + b.Navigation("LibraryLinks"); + + b.Navigation("People"); + + b.Navigation("Seasons"); }); #pragma warning restore 612, 618 } diff --git a/Kyoo/Models/DatabaseMigrations/Internal/20210128212212_Initial.cs b/Kyoo/Models/DatabaseMigrations/Internal/20210216202218_Initial.cs similarity index 73% rename from Kyoo/Models/DatabaseMigrations/Internal/20210128212212_Initial.cs rename to Kyoo/Models/DatabaseMigrations/Internal/20210216202218_Initial.cs index 04349e48..e15d9e45 100644 --- a/Kyoo/Models/DatabaseMigrations/Internal/20210128212212_Initial.cs +++ b/Kyoo/Models/DatabaseMigrations/Internal/20210216202218_Initial.cs @@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Kyoo.Models.DatabaseMigrations.Internal +namespace Kyoo.Kyoo.Models.DatabaseMigrations.Internal { public partial class Initial : Migration { @@ -17,12 +17,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "Collections", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Slug = table.Column(nullable: false), - Name = table.Column(nullable: true), - Poster = table.Column(nullable: true), - Overview = table.Column(nullable: true) + Slug = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: true), + Poster = table.Column(type: "text", nullable: true), + Overview = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -33,10 +33,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "Genres", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Slug = table.Column(nullable: false), - Name = table.Column(nullable: true) + Slug = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -47,10 +47,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "Libraries", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Slug = table.Column(nullable: false), - Name = table.Column(nullable: true), + Slug = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: true), Paths = table.Column(type: "text[]", nullable: true) }, constraints: table => @@ -62,11 +62,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "People", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Slug = table.Column(nullable: false), - Name = table.Column(nullable: true), - Poster = table.Column(nullable: true) + Slug = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: true), + Poster = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -77,11 +77,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "Providers", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Slug = table.Column(nullable: false), - Name = table.Column(nullable: true), - Logo = table.Column(nullable: true) + Slug = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: true), + Logo = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -92,10 +92,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "Studios", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Slug = table.Column(nullable: false), - Name = table.Column(nullable: true) + Slug = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -106,46 +106,46 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "ProviderLinks", columns: table => new { - ParentID = table.Column(nullable: false), - ChildID = table.Column(nullable: false) + ParentID = table.Column(type: "integer", nullable: false), + ChildID = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ProviderLinks", x => new { x.ParentID, x.ChildID }); - table.ForeignKey( - name: "FK_ProviderLinks_Providers_ChildID", - column: x => x.ChildID, - principalTable: "Providers", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ProviderLinks_Libraries_ParentID", column: x => x.ParentID, principalTable: "Libraries", principalColumn: "ID", onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProviderLinks_Providers_ChildID", + column: x => x.ChildID, + principalTable: "Providers", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Shows", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Slug = table.Column(nullable: false), - Title = table.Column(nullable: true), + Slug = table.Column(type: "text", nullable: false), + Title = table.Column(type: "text", nullable: true), Aliases = table.Column(type: "text[]", nullable: true), - Path = table.Column(nullable: true), - Overview = table.Column(nullable: true), - Status = table.Column(nullable: true), - TrailerUrl = table.Column(nullable: true), - StartYear = table.Column(nullable: true), - EndYear = table.Column(nullable: true), - Poster = table.Column(nullable: true), - Logo = table.Column(nullable: true), - Backdrop = table.Column(nullable: true), - IsMovie = table.Column(nullable: false), - StudioID = table.Column(nullable: true) + Path = table.Column(type: "text", nullable: true), + Overview = table.Column(type: "text", nullable: true), + Status = table.Column(type: "integer", nullable: true), + TrailerUrl = table.Column(type: "text", nullable: true), + StartYear = table.Column(type: "integer", nullable: true), + EndYear = table.Column(type: "integer", nullable: true), + Poster = table.Column(type: "text", nullable: true), + Logo = table.Column(type: "text", nullable: true), + Backdrop = table.Column(type: "text", nullable: true), + IsMovie = table.Column(type: "boolean", nullable: false), + StudioID = table.Column(type: "integer", nullable: true) }, constraints: table => { @@ -162,32 +162,32 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "CollectionLinks", columns: table => new { - ParentID = table.Column(nullable: false), - ChildID = table.Column(nullable: false) + ParentID = table.Column(type: "integer", nullable: false), + ChildID = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_CollectionLinks", x => new { x.ParentID, x.ChildID }); - table.ForeignKey( - name: "FK_CollectionLinks_Shows_ChildID", - column: x => x.ChildID, - principalTable: "Shows", - principalColumn: "ID", - onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_CollectionLinks_Collections_ParentID", column: x => x.ParentID, principalTable: "Collections", principalColumn: "ID", onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CollectionLinks_Shows_ChildID", + column: x => x.ChildID, + principalTable: "Shows", + principalColumn: "ID", + onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "GenreLinks", columns: table => new { - ParentID = table.Column(nullable: false), - ChildID = table.Column(nullable: false) + ParentID = table.Column(type: "integer", nullable: false), + ChildID = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -210,11 +210,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "LibraryLinks", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - LibraryID = table.Column(nullable: false), - ShowID = table.Column(nullable: true), - CollectionID = table.Column(nullable: true) + LibraryID = table.Column(type: "integer", nullable: false), + ShowID = table.Column(type: "integer", nullable: true), + CollectionID = table.Column(type: "integer", nullable: true) }, constraints: table => { @@ -243,12 +243,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "PeopleRoles", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - PeopleID = table.Column(nullable: false), - ShowID = table.Column(nullable: false), - Role = table.Column(nullable: true), - Type = table.Column(nullable: true) + PeopleID = table.Column(type: "integer", nullable: false), + ShowID = table.Column(type: "integer", nullable: false), + Role = table.Column(type: "text", nullable: true), + Type = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -271,14 +271,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "Seasons", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ShowID = table.Column(nullable: false), - SeasonNumber = table.Column(nullable: false), - Title = table.Column(nullable: true), - Overview = table.Column(nullable: true), - Year = table.Column(nullable: true), - Poster = table.Column(nullable: true) + ShowID = table.Column(type: "integer", nullable: false), + SeasonNumber = table.Column(type: "integer", nullable: false), + Title = table.Column(type: "text", nullable: true), + Overview = table.Column(type: "text", nullable: true), + Year = table.Column(type: "integer", nullable: true), + Poster = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -295,19 +295,19 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "Episodes", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ShowID = table.Column(nullable: false), - SeasonID = table.Column(nullable: true), - SeasonNumber = table.Column(nullable: false), - EpisodeNumber = table.Column(nullable: false), - AbsoluteNumber = table.Column(nullable: false), - Path = table.Column(nullable: true), - Title = table.Column(nullable: true), - Overview = table.Column(nullable: true), - ReleaseDate = table.Column(nullable: true), - Runtime = table.Column(nullable: false), - Poster = table.Column(nullable: true) + ShowID = table.Column(type: "integer", nullable: false), + SeasonID = table.Column(type: "integer", nullable: true), + SeasonNumber = table.Column(type: "integer", nullable: false), + EpisodeNumber = table.Column(type: "integer", nullable: false), + AbsoluteNumber = table.Column(type: "integer", nullable: false), + Path = table.Column(type: "text", nullable: true), + Title = table.Column(type: "text", nullable: true), + Overview = table.Column(type: "text", nullable: true), + ReleaseDate = table.Column(type: "timestamp without time zone", nullable: true), + Runtime = table.Column(type: "integer", nullable: false), + Poster = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -330,15 +330,15 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "MetadataIds", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ProviderID = table.Column(nullable: false), - ShowID = table.Column(nullable: true), - EpisodeID = table.Column(nullable: true), - SeasonID = table.Column(nullable: true), - PeopleID = table.Column(nullable: true), - DataID = table.Column(nullable: true), - Link = table.Column(nullable: true) + ProviderID = table.Column(type: "integer", nullable: false), + ShowID = table.Column(type: "integer", nullable: true), + EpisodeID = table.Column(type: "integer", nullable: true), + SeasonID = table.Column(type: "integer", nullable: true), + PeopleID = table.Column(type: "integer", nullable: true), + DataID = table.Column(type: "text", nullable: true), + Link = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -379,17 +379,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "Tracks", columns: table => new { - ID = table.Column(nullable: false) + ID = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Title = table.Column(nullable: true), - Language = table.Column(nullable: true), - Codec = table.Column(nullable: true), - Path = table.Column(nullable: true), - Type = table.Column(nullable: false), - EpisodeID = table.Column(nullable: false), - IsDefault = table.Column(nullable: false), - IsForced = table.Column(nullable: false), - IsExternal = table.Column(nullable: false) + EpisodeID = table.Column(type: "integer", nullable: false), + IsDefault = table.Column(type: "boolean", nullable: false), + IsForced = table.Column(type: "boolean", nullable: false), + IsExternal = table.Column(type: "boolean", nullable: false), + Title = table.Column(type: "text", nullable: true), + Language = table.Column(type: "text", nullable: true), + Codec = table.Column(type: "text", nullable: true), + Path = table.Column(type: "text", nullable: true), + Type = table.Column(type: "integer", nullable: false) }, constraints: table => { @@ -446,11 +446,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal table: "LibraryLinks", column: "CollectionID"); - migrationBuilder.CreateIndex( - name: "IX_LibraryLinks_ShowID", - table: "LibraryLinks", - column: "ShowID"); - migrationBuilder.CreateIndex( name: "IX_LibraryLinks_LibraryID_CollectionID", table: "LibraryLinks", @@ -463,6 +458,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: new[] { "LibraryID", "ShowID" }, unique: true); + migrationBuilder.CreateIndex( + name: "IX_LibraryLinks_ShowID", + table: "LibraryLinks", + column: "ShowID"); + migrationBuilder.CreateIndex( name: "IX_MetadataIds_EpisodeID", table: "MetadataIds", @@ -577,10 +577,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal name: "People"); migrationBuilder.DropTable( - name: "Providers"); + name: "Libraries"); migrationBuilder.DropTable( - name: "Libraries"); + name: "Providers"); migrationBuilder.DropTable( name: "Episodes"); diff --git a/Kyoo/Models/DatabaseMigrations/Internal/DatabaseContextModelSnapshot.cs b/Kyoo/Models/DatabaseMigrations/Internal/DatabaseContextModelSnapshot.cs index ac3e38f6..c34b0309 100644 --- a/Kyoo/Models/DatabaseMigrations/Internal/DatabaseContextModelSnapshot.cs +++ b/Kyoo/Models/DatabaseMigrations/Internal/DatabaseContextModelSnapshot.cs @@ -1,13 +1,12 @@ // using System; -using System.Collections.Generic; using Kyoo; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Kyoo.Models.DatabaseMigrations.Internal +namespace Kyoo.Kyoo.Models.DatabaseMigrations.Internal { [DbContext(typeof(DatabaseContext))] partial class DatabaseContextModelSnapshot : ModelSnapshot @@ -16,12 +15,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Npgsql:Enum:item_type", "show,movie,collection") - .HasAnnotation("Npgsql:Enum:status", "finished,airing,planned,unknown") - .HasAnnotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,font") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) - .HasAnnotation("ProductVersion", "3.1.3") - .HasAnnotation("Relational:MaxIdentifierLength", 63); + .HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" }) + .HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" }) + .HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "font" }) + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); modelBuilder.Entity("Kyoo.Models.CollectionDE", b => { @@ -49,8 +48,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .IsUnique(); b.ToTable("Collections"); - - b.HasDiscriminator(); }); modelBuilder.Entity("Kyoo.Models.CollectionLink", b => @@ -138,8 +135,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .IsUnique(); b.ToTable("Genres"); - - b.HasDiscriminator(); }); modelBuilder.Entity("Kyoo.Models.GenreLink", b => @@ -167,7 +162,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal b.Property("Name") .HasColumnType("text"); - b.Property>("Paths") + b.Property("Paths") .HasColumnType("text[]"); b.Property("Slug") @@ -180,8 +175,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .IsUnique(); b.ToTable("Libraries"); - - b.HasDiscriminator(); }); modelBuilder.Entity("Kyoo.Models.LibraryLink", b => @@ -391,7 +384,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasColumnType("integer") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - b.Property>("Aliases") + b.Property("Aliases") .HasColumnType("text[]"); b.Property("Backdrop") @@ -442,8 +435,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal b.HasIndex("StudioID"); b.ToTable("Shows"); - - b.HasDiscriminator(); }); modelBuilder.Entity("Kyoo.Models.Studio", b => @@ -522,6 +513,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ParentID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Child"); + + b.Navigation("Parent"); }); modelBuilder.Entity("Kyoo.Models.Episode", b => @@ -535,6 +530,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Season"); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.GenreLink", b => @@ -550,6 +549,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ParentID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Child"); + + b.Navigation("Parent"); }); modelBuilder.Entity("Kyoo.Models.LibraryLink", b => @@ -569,6 +572,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .WithMany("LibraryLinks") .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Collection"); + + b.Navigation("Library"); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.MetadataID", b => @@ -598,6 +607,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .WithMany("ExternalIDs") .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Episode"); + + b.Navigation("People"); + + b.Navigation("Provider"); + + b.Navigation("Season"); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.PeopleRole", b => @@ -613,6 +632,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("People"); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.ProviderLink", b => @@ -628,6 +651,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ParentID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Child"); + + b.Navigation("Parent"); }); modelBuilder.Entity("Kyoo.Models.Season", b => @@ -637,6 +664,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("ShowID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Show"); }); modelBuilder.Entity("Kyoo.Models.ShowDE", b => @@ -644,6 +673,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal b.HasOne("Kyoo.Models.Studio", "Studio") .WithMany() .HasForeignKey("StudioID"); + + b.Navigation("Studio"); }); modelBuilder.Entity("Kyoo.Models.Track", b => @@ -653,6 +684,65 @@ namespace Kyoo.Models.DatabaseMigrations.Internal .HasForeignKey("EpisodeID") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + + b.Navigation("Episode"); + }); + + modelBuilder.Entity("Kyoo.Models.CollectionDE", b => + { + b.Navigation("LibraryLinks"); + + b.Navigation("Links"); + }); + + modelBuilder.Entity("Kyoo.Models.Episode", b => + { + b.Navigation("ExternalIDs"); + + b.Navigation("Tracks"); + }); + + modelBuilder.Entity("Kyoo.Models.GenreDE", b => + { + b.Navigation("Links"); + }); + + modelBuilder.Entity("Kyoo.Models.LibraryDE", b => + { + b.Navigation("Links"); + + b.Navigation("ProviderLinks"); + }); + + modelBuilder.Entity("Kyoo.Models.People", b => + { + b.Navigation("ExternalIDs"); + + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Kyoo.Models.Season", b => + { + b.Navigation("Episodes"); + + b.Navigation("ExternalIDs"); + }); + + modelBuilder.Entity("Kyoo.Models.ShowDE", b => + { + b.Navigation("CollectionLinks"); + + b.Navigation("Episodes"); + + b.Navigation("ExternalIDs"); + + b.Navigation("GenreLinks"); + + b.Navigation("LibraryLinks"); + + b.Navigation("People"); + + b.Navigation("Seasons"); }); #pragma warning restore 612, 618 } diff --git a/Kyoo/Models/IdentityDatabase.cs b/Kyoo/Models/IdentityDatabase.cs index 99cc5384..f70f07b3 100644 --- a/Kyoo/Models/IdentityDatabase.cs +++ b/Kyoo/Models/IdentityDatabase.cs @@ -11,6 +11,7 @@ using Microsoft.Extensions.Options; namespace Kyoo { + // The configuration's database is named ConfigurationDbContext. public class IdentityDatabase : IdentityDbContext, IPersistedGrantDbContext { private readonly IOptions _operationalStoreOptions; diff --git a/Kyoo/Startup.cs b/Kyoo/Startup.cs index 948bdb7a..ea3aabcd 100644 --- a/Kyoo/Startup.cs +++ b/Kyoo/Startup.cs @@ -146,8 +146,8 @@ namespace Kyoo services.AddScoped(); services.AddScoped(); services.AddScoped(); - - // services.AddScoped(); + + services.AddScoped(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); diff --git a/Kyoo/Tasks/CreateDatabase.cs b/Kyoo/Tasks/CreateDatabase.cs index bd372ae8..2264b116 100644 --- a/Kyoo/Tasks/CreateDatabase.cs +++ b/Kyoo/Tasks/CreateDatabase.cs @@ -28,9 +28,9 @@ namespace Kyoo.Tasks IdentityDatabase identityDatabase = serviceScope.ServiceProvider.GetService(); ConfigurationDbContext identityContext = serviceScope.ServiceProvider.GetService(); - databaseContext.Database.Migrate(); - identityDatabase.Database.Migrate(); - identityContext.Database.Migrate(); + databaseContext!.Database.Migrate(); + identityDatabase!.Database.Migrate(); + identityContext!.Database.Migrate(); if (!identityContext.Clients.Any()) {