Fixing dotnet-ef types

This commit is contained in:
Zoe Roux 2021-02-16 22:04:51 +01:00
parent bc7a314409
commit 5c848ca01c
16 changed files with 1371 additions and 795 deletions

View File

@ -9,7 +9,7 @@ namespace Kyoo.Models
[JsonIgnore] public int ID { get; set; } [JsonIgnore] public int ID { get; set; }
public string Slug { get; set; } public string Slug { get; set; }
public string Name { get; set; } public string Name { get; set; }
public ICollection<string> Paths { get; set; } public string[] Paths { get; set; }
[EditableRelation] public virtual ICollection<ProviderID> Providers { get; set; } [EditableRelation] public virtual ICollection<ProviderID> Providers { get; set; }

View File

@ -9,7 +9,7 @@ namespace Kyoo.Models
public int ID { get; set; } public int ID { get; set; }
public string Slug { get; set; } public string Slug { get; set; }
public string Title { get; set; } public string Title { get; set; }
[EditableRelation] public ICollection<string> Aliases { get; set; } [EditableRelation] public string[] Aliases { get; set; }
[JsonIgnore] public string Path { get; set; } [JsonIgnore] public string Path { get; set; }
public string Overview { get; set; } public string Overview { get; set; }
public Status? Status { get; set; } public Status? Status { get; set; }

View File

@ -105,6 +105,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Models\DatabaseMigrations" /> <Folder Include="Models\DatabaseMigrations" />
<Folder Include="Models\DatabaseMigrations\IdentityDatbase" />
<Folder Include="Models\DatabaseMigrations\Internal" /> <Folder Include="Models\DatabaseMigrations\Internal" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -43,11 +42,6 @@ namespace Kyoo
NpgsqlConnection.GlobalTypeMapper.MapEnum<ItemType>(); NpgsqlConnection.GlobalTypeMapper.MapEnum<ItemType>();
NpgsqlConnection.GlobalTypeMapper.MapEnum<StreamType>(); NpgsqlConnection.GlobalTypeMapper.MapEnum<StreamType>();
} }
private readonly ValueComparer<ICollection<string>> _stringArrayComparer = new(
(l1, l2) => l1.SequenceEqual(l2),
arr => arr.Aggregate(0, (i, s) => s.GetHashCode())
);
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
@ -61,16 +55,14 @@ namespace Kyoo
modelBuilder.Ignore<Collection>(); modelBuilder.Ignore<Collection>();
modelBuilder.Ignore<Show>(); modelBuilder.Ignore<Show>();
modelBuilder.Ignore<Genre>(); modelBuilder.Ignore<Genre>();
modelBuilder.Entity<LibraryDE>() modelBuilder.Entity<LibraryDE>()
.Property(x => x.Paths) .Property(x => x.Paths)
.HasColumnType("text[]") .HasColumnType("text[]");
.Metadata.SetValueComparer(_stringArrayComparer);
modelBuilder.Entity<ShowDE>() modelBuilder.Entity<ShowDE>()
.Property(x => x.Aliases) .Property(x => x.Aliases)
.HasColumnType("text[]") .HasColumnType("text[]");
.Metadata.SetValueComparer(_stringArrayComparer);
modelBuilder.Entity<Track>() modelBuilder.Entity<Track>()
.Property(t => t.IsDefault) .Property(t => t.IsDefault)

View File

@ -10,16 +10,16 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
{ {
[DbContext(typeof(ConfigurationDbContext))] [DbContext(typeof(ConfigurationDbContext))]
[Migration("20200526235342_Initial")] [Migration("20210216205007_Initial")]
partial class Initial partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "3.1.3") .HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{ {
@ -28,16 +28,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AllowedAccessTokenSigningAlgorithms")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Created") b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(1000)") .HasMaxLength(1000)
.HasMaxLength(1000); .HasColumnType("character varying(1000)");
b.Property<string>("DisplayName") b.Property<string>("DisplayName")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("Enabled") b.Property<bool>("Enabled")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -47,12 +51,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("NonEditable") b.Property<bool>("NonEditable")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated") b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
@ -76,14 +83,14 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiResourceId"); b.HasIndex("ApiResourceId");
b.ToTable("ApiClaims"); b.ToTable("ApiResourceClaims");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
@ -98,22 +105,22 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Key") b.Property<string>("Key")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiResourceId"); 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<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -123,21 +130,80 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<int>("ApiResourceId") b.Property<int>("ApiResourceId")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(1000)") .HasMaxLength(1000)
.HasMaxLength(1000); .HasColumnType("character varying(1000)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("DisplayName") b.Property<string>("DisplayName")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("Emphasize") b.Property<bool>("Emphasize")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("Required") b.Property<bool>("Required")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -147,8 +213,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.HasIndex("Name") b.HasIndex("Name")
.IsUnique(); .IsUnique();
@ -162,56 +226,46 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiScopeId") b.Property<int>("ScopeId")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiScopeId"); b.HasIndex("ScopeId");
b.ToTable("ApiScopeClaims"); b.ToTable("ApiScopeClaims");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId") b.Property<string>("Key")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(4000)") .HasMaxLength(2000)
.HasMaxLength(4000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiResourceId"); b.HasIndex("ScopeId");
b.ToTable("ApiSecrets"); b.ToTable("ApiScopeProperties");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b =>
@ -242,6 +296,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<bool>("AllowRememberConsent") b.Property<bool>("AllowRememberConsent")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("AllowedIdentityTokenSigningAlgorithms")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken") b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -255,25 +313,25 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri") b.Property<string>("BackChannelLogoutUri")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<string>("ClientClaimsPrefix") b.Property<string>("ClientClaimsPrefix")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientName") b.Property<string>("ClientName")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientUri") b.Property<string>("ClientUri")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<int?>("ConsentLifetime") b.Property<int?>("ConsentLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -282,8 +340,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(1000)") .HasMaxLength(1000)
.HasMaxLength(1000); .HasColumnType("character varying(1000)");
b.Property<int>("DeviceCodeLifetime") b.Property<int>("DeviceCodeLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -298,8 +356,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri") b.Property<string>("FrontChannelLogoutUri")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<int>("IdentityTokenLifetime") b.Property<int>("IdentityTokenLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -311,20 +369,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri") b.Property<string>("LogoUri")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<bool>("NonEditable") b.Property<bool>("NonEditable")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt") b.Property<string>("PairWiseSubjectSalt")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ProtocolType") b.Property<string>("ProtocolType")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<int>("RefreshTokenExpiration") b.Property<int>("RefreshTokenExpiration")
.HasColumnType("integer"); .HasColumnType("integer");
@ -341,6 +399,9 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<bool>("RequirePkce") b.Property<bool>("RequirePkce")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("RequireRequestObject")
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime") b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -351,8 +412,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType") b.Property<string>("UserCodeType")
.HasColumnType("character varying(100)") .HasMaxLength(100)
.HasMaxLength(100); .HasColumnType("character varying(100)");
b.Property<int?>("UserSsoLifetime") b.Property<int?>("UserSsoLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -377,13 +438,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.HasKey("Id"); b.HasKey("Id");
@ -404,8 +465,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Origin") b.Property<string>("Origin")
.IsRequired() .IsRequired()
.HasColumnType("character varying(150)") .HasMaxLength(150)
.HasMaxLength(150); .HasColumnType("character varying(150)");
b.HasKey("Id"); b.HasKey("Id");
@ -426,8 +487,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("GrantType") b.Property<string>("GrantType")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.HasKey("Id"); b.HasKey("Id");
@ -448,8 +509,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Provider") b.Property<string>("Provider")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("Id"); b.HasKey("Id");
@ -470,8 +531,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("PostLogoutRedirectUri") b.Property<string>("PostLogoutRedirectUri")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
@ -492,13 +553,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Key") b.Property<string>("Key")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
@ -519,8 +580,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("RedirectUri") b.Property<string>("RedirectUri")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
@ -541,8 +602,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Scope") b.Property<string>("Scope")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("Id"); b.HasKey("Id");
@ -565,21 +626,21 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(4000)") .HasMaxLength(4000)
.HasMaxLength(4000); .HasColumnType("character varying(4000)");
b.HasKey("Id"); b.HasKey("Id");
@ -588,28 +649,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.ToTable("ClientSecrets"); b.ToTable("ClientSecrets");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -621,12 +660,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(1000)") .HasMaxLength(1000)
.HasMaxLength(1000); .HasColumnType("character varying(1000)");
b.Property<string>("DisplayName") b.Property<string>("DisplayName")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("Emphasize") b.Property<bool>("Emphasize")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -636,8 +675,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("NonEditable") b.Property<bool>("NonEditable")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -659,6 +698,28 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.ToTable("IdentityResources"); b.ToTable("IdentityResources");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -671,19 +732,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Key") b.Property<string>("Key")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("IdentityResourceId"); b.HasIndex("IdentityResourceId");
b.ToTable("IdentityProperties"); b.ToTable("IdentityResourceProperties");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
@ -693,6 +754,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ApiResourceId") .HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("ApiResource");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
@ -702,33 +765,52 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ApiResourceId") .HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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") b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Scopes") .WithMany("Scopes")
.HasForeignKey("ApiResourceId") .HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("ApiResource");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b =>
{ {
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Secrets") .WithMany("Secrets")
.HasForeignKey("ApiResourceId") .HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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 => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
@ -738,6 +820,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
@ -747,6 +831,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
@ -756,6 +842,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
@ -765,6 +853,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
@ -774,6 +864,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
@ -783,6 +875,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
@ -792,6 +886,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
@ -801,6 +897,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
@ -810,15 +908,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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") b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("UserClaims") .WithMany("UserClaims")
.HasForeignKey("IdentityResourceId") .HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("IdentityResource");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
@ -828,6 +930,54 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("IdentityResourceId") .HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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 #pragma warning restore 612, 618
} }

View File

@ -12,69 +12,92 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ApiResources", name: "ApiResources",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false), Enabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false), Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true), DisplayName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true), Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
Created = table.Column<DateTime>(nullable: false), AllowedAccessTokenSigningAlgorithms = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
Updated = table.Column<DateTime>(nullable: true), ShowInDiscoveryDocument = table.Column<bool>(type: "boolean", nullable: false),
LastAccessed = table.Column<DateTime>(nullable: true), Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
NonEditable = table.Column<bool>(nullable: false) Updated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
LastAccessed = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
NonEditable = table.Column<bool>(type: "boolean", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ApiResources", x => x.Id); table.PrimaryKey("PK_ApiResources", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "ApiScopes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DisplayName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
Required = table.Column<bool>(type: "boolean", nullable: false),
Emphasize = table.Column<bool>(type: "boolean", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiScopes", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Clients", name: "Clients",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false), Enabled = table.Column<bool>(type: "boolean", nullable: false),
ClientId = table.Column<string>(maxLength: 200, nullable: false), ClientId = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
ProtocolType = table.Column<string>(maxLength: 200, nullable: false), ProtocolType = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
RequireClientSecret = table.Column<bool>(nullable: false), RequireClientSecret = table.Column<bool>(type: "boolean", nullable: false),
ClientName = table.Column<string>(maxLength: 200, nullable: true), ClientName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true), Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
ClientUri = table.Column<string>(maxLength: 2000, nullable: true), ClientUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
LogoUri = table.Column<string>(maxLength: 2000, nullable: true), LogoUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
RequireConsent = table.Column<bool>(nullable: false), RequireConsent = table.Column<bool>(type: "boolean", nullable: false),
AllowRememberConsent = table.Column<bool>(nullable: false), AllowRememberConsent = table.Column<bool>(type: "boolean", nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(nullable: false), AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "boolean", nullable: false),
RequirePkce = table.Column<bool>(nullable: false), RequirePkce = table.Column<bool>(type: "boolean", nullable: false),
AllowPlainTextPkce = table.Column<bool>(nullable: false), AllowPlainTextPkce = table.Column<bool>(type: "boolean", nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(nullable: false), RequireRequestObject = table.Column<bool>(type: "boolean", nullable: false),
FrontChannelLogoutUri = table.Column<string>(maxLength: 2000, nullable: true), AllowAccessTokensViaBrowser = table.Column<bool>(type: "boolean", nullable: false),
FrontChannelLogoutSessionRequired = table.Column<bool>(nullable: false), FrontChannelLogoutUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
BackChannelLogoutUri = table.Column<string>(maxLength: 2000, nullable: true), FrontChannelLogoutSessionRequired = table.Column<bool>(type: "boolean", nullable: false),
BackChannelLogoutSessionRequired = table.Column<bool>(nullable: false), BackChannelLogoutUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
AllowOfflineAccess = table.Column<bool>(nullable: false), BackChannelLogoutSessionRequired = table.Column<bool>(type: "boolean", nullable: false),
IdentityTokenLifetime = table.Column<int>(nullable: false), AllowOfflineAccess = table.Column<bool>(type: "boolean", nullable: false),
AccessTokenLifetime = table.Column<int>(nullable: false), IdentityTokenLifetime = table.Column<int>(type: "integer", nullable: false),
AuthorizationCodeLifetime = table.Column<int>(nullable: false), AllowedIdentityTokenSigningAlgorithms = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
ConsentLifetime = table.Column<int>(nullable: true), AccessTokenLifetime = table.Column<int>(type: "integer", nullable: false),
AbsoluteRefreshTokenLifetime = table.Column<int>(nullable: false), AuthorizationCodeLifetime = table.Column<int>(type: "integer", nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(nullable: false), ConsentLifetime = table.Column<int>(type: "integer", nullable: true),
RefreshTokenUsage = table.Column<int>(nullable: false), AbsoluteRefreshTokenLifetime = table.Column<int>(type: "integer", nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(nullable: false), SlidingRefreshTokenLifetime = table.Column<int>(type: "integer", nullable: false),
RefreshTokenExpiration = table.Column<int>(nullable: false), RefreshTokenUsage = table.Column<int>(type: "integer", nullable: false),
AccessTokenType = table.Column<int>(nullable: false), UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "boolean", nullable: false),
EnableLocalLogin = table.Column<bool>(nullable: false), RefreshTokenExpiration = table.Column<int>(type: "integer", nullable: false),
IncludeJwtId = table.Column<bool>(nullable: false), AccessTokenType = table.Column<int>(type: "integer", nullable: false),
AlwaysSendClientClaims = table.Column<bool>(nullable: false), EnableLocalLogin = table.Column<bool>(type: "boolean", nullable: false),
ClientClaimsPrefix = table.Column<string>(maxLength: 200, nullable: true), IncludeJwtId = table.Column<bool>(type: "boolean", nullable: false),
PairWiseSubjectSalt = table.Column<string>(maxLength: 200, nullable: true), AlwaysSendClientClaims = table.Column<bool>(type: "boolean", nullable: false),
Created = table.Column<DateTime>(nullable: false), ClientClaimsPrefix = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Updated = table.Column<DateTime>(nullable: true), PairWiseSubjectSalt = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
LastAccessed = table.Column<DateTime>(nullable: true), Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
UserSsoLifetime = table.Column<int>(nullable: true), Updated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
UserCodeType = table.Column<string>(maxLength: 100, nullable: true), LastAccessed = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
DeviceCodeLifetime = table.Column<int>(nullable: false), UserSsoLifetime = table.Column<int>(type: "integer", nullable: true),
NonEditable = table.Column<bool>(nullable: false) UserCodeType = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
DeviceCodeLifetime = table.Column<int>(type: "integer", nullable: false),
NonEditable = table.Column<bool>(type: "boolean", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -85,18 +108,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "IdentityResources", name: "IdentityResources",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false), Enabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false), Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true), DisplayName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true), Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
Required = table.Column<bool>(nullable: false), Required = table.Column<bool>(type: "boolean", nullable: false),
Emphasize = table.Column<bool>(nullable: false), Emphasize = table.Column<bool>(type: "boolean", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false), ShowInDiscoveryDocument = table.Column<bool>(type: "boolean", nullable: false),
Created = table.Column<DateTime>(nullable: false), Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Updated = table.Column<DateTime>(nullable: true), Updated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
NonEditable = table.Column<bool>(nullable: false) NonEditable = table.Column<bool>(type: "boolean", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -104,19 +127,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ApiClaims", name: "ApiResourceClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false), ApiResourceId = table.Column<int>(type: "integer", nullable: false),
ApiResourceId = table.Column<int>(nullable: false) Type = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ApiClaims", x => x.Id); table.PrimaryKey("PK_ApiResourceClaims", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_ApiClaims_ApiResources_ApiResourceId", name: "FK_ApiResourceClaims_ApiResources_ApiResourceId",
column: x => x.ApiResourceId, column: x => x.ApiResourceId,
principalTable: "ApiResources", principalTable: "ApiResources",
principalColumn: "Id", principalColumn: "Id",
@ -124,20 +147,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ApiProperties", name: "ApiResourceProperties",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false), ApiResourceId = table.Column<int>(type: "integer", nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false), Key = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
ApiResourceId = table.Column<int>(nullable: false) Value = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ApiProperties", x => x.Id); table.PrimaryKey("PK_ApiResourceProperties", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_ApiProperties_ApiResources_ApiResourceId", name: "FK_ApiResourceProperties_ApiResources_ApiResourceId",
column: x => x.ApiResourceId, column: x => x.ApiResourceId,
principalTable: "ApiResources", principalTable: "ApiResources",
principalColumn: "Id", principalColumn: "Id",
@ -145,24 +168,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ApiScopes", name: "ApiResourceScopes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(maxLength: 200, nullable: false), Scope = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true), ApiResourceId = table.Column<int>(type: "integer", nullable: false)
Description = table.Column<string>(maxLength: 1000, nullable: true),
Required = table.Column<bool>(nullable: false),
Emphasize = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ApiScopes", x => x.Id); table.PrimaryKey("PK_ApiResourceScopes", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_ApiScopes_ApiResources_ApiResourceId", name: "FK_ApiResourceScopes_ApiResources_ApiResourceId",
column: x => x.ApiResourceId, column: x => x.ApiResourceId,
principalTable: "ApiResources", principalTable: "ApiResources",
principalColumn: "Id", principalColumn: "Id",
@ -170,38 +188,79 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "ApiSecrets", name: "ApiResourceSecrets",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Description = table.Column<string>(maxLength: 1000, nullable: true), ApiResourceId = table.Column<int>(type: "integer", nullable: false),
Value = table.Column<string>(maxLength: 4000, nullable: false), Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
Expiration = table.Column<DateTime>(nullable: true), Value = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false),
Type = table.Column<string>(maxLength: 250, nullable: false), Expiration = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Created = table.Column<DateTime>(nullable: false), Type = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
ApiResourceId = table.Column<int>(nullable: false) Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ApiSecrets", x => x.Id); table.PrimaryKey("PK_ApiResourceSecrets", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_ApiSecrets_ApiResources_ApiResourceId", name: "FK_ApiResourceSecrets_ApiResources_ApiResourceId",
column: x => x.ApiResourceId, column: x => x.ApiResourceId,
principalTable: "ApiResources", principalTable: "ApiResources",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "ApiScopeClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ScopeId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<string>(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<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ScopeId = table.Column<int>(type: "integer", nullable: false),
Key = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(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( migrationBuilder.CreateTable(
name: "ClientClaims", name: "ClientClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 250, nullable: false), Type = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 250, nullable: false), Value = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
ClientId = table.Column<int>(nullable: false) ClientId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -218,10 +277,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientCorsOrigins", name: "ClientCorsOrigins",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Origin = table.Column<string>(maxLength: 150, nullable: false), Origin = table.Column<string>(type: "character varying(150)", maxLength: 150, nullable: false),
ClientId = table.Column<int>(nullable: false) ClientId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -238,10 +297,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientGrantTypes", name: "ClientGrantTypes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
GrantType = table.Column<string>(maxLength: 250, nullable: false), GrantType = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
ClientId = table.Column<int>(nullable: false) ClientId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -258,10 +317,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientIdPRestrictions", name: "ClientIdPRestrictions",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Provider = table.Column<string>(maxLength: 200, nullable: false), Provider = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
ClientId = table.Column<int>(nullable: false) ClientId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -278,10 +337,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientPostLogoutRedirectUris", name: "ClientPostLogoutRedirectUris",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PostLogoutRedirectUri = table.Column<string>(maxLength: 2000, nullable: false), PostLogoutRedirectUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
ClientId = table.Column<int>(nullable: false) ClientId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -298,11 +357,11 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientProperties", name: "ClientProperties",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false), ClientId = table.Column<int>(type: "integer", nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false), Key = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
ClientId = table.Column<int>(nullable: false) Value = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -319,10 +378,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientRedirectUris", name: "ClientRedirectUris",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RedirectUri = table.Column<string>(maxLength: 2000, nullable: false), RedirectUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
ClientId = table.Column<int>(nullable: false) ClientId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -339,10 +398,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientScopes", name: "ClientScopes",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Scope = table.Column<string>(maxLength: 200, nullable: false), Scope = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
ClientId = table.Column<int>(nullable: false) ClientId = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -359,14 +418,14 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientSecrets", name: "ClientSecrets",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Description = table.Column<string>(maxLength: 2000, nullable: true), ClientId = table.Column<int>(type: "integer", nullable: false),
Value = table.Column<string>(maxLength: 4000, nullable: false), Description = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
Expiration = table.Column<DateTime>(nullable: true), Value = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false),
Type = table.Column<string>(maxLength: 250, nullable: false), Expiration = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Created = table.Column<DateTime>(nullable: false), Type = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
ClientId = table.Column<int>(nullable: false) Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -380,19 +439,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "IdentityClaims", name: "IdentityResourceClaims",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false), IdentityResourceId = table.Column<int>(type: "integer", nullable: false),
IdentityResourceId = table.Column<int>(nullable: false) Type = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_IdentityClaims", x => x.Id); table.PrimaryKey("PK_IdentityResourceClaims", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_IdentityClaims_IdentityResources_IdentityResourceId", name: "FK_IdentityResourceClaims_IdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId, column: x => x.IdentityResourceId,
principalTable: "IdentityResources", principalTable: "IdentityResources",
principalColumn: "Id", principalColumn: "Id",
@ -400,54 +459,34 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "IdentityProperties", name: "IdentityResourceProperties",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false), IdentityResourceId = table.Column<int>(type: "integer", nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false), Key = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
IdentityResourceId = table.Column<int>(nullable: false) Value = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_IdentityProperties", x => x.Id); table.PrimaryKey("PK_IdentityResourceProperties", x => x.Id);
table.ForeignKey( table.ForeignKey(
name: "FK_IdentityProperties_IdentityResources_IdentityResourceId", name: "FK_IdentityResourceProperties_IdentityResources_IdentityResour~",
column: x => x.IdentityResourceId, column: x => x.IdentityResourceId,
principalTable: "IdentityResources", principalTable: "IdentityResources",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "ApiScopeClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false),
ApiScopeId = table.Column<int>(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( migrationBuilder.CreateIndex(
name: "IX_ApiClaims_ApiResourceId", name: "IX_ApiResourceClaims_ApiResourceId",
table: "ApiClaims", table: "ApiResourceClaims",
column: "ApiResourceId"); column: "ApiResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiProperties_ApiResourceId", name: "IX_ApiResourceProperties_ApiResourceId",
table: "ApiProperties", table: "ApiResourceProperties",
column: "ApiResourceId"); column: "ApiResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
@ -457,26 +496,31 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
unique: true); unique: true);
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ApiScopeId", name: "IX_ApiResourceScopes_ApiResourceId",
table: "ApiScopeClaims", table: "ApiResourceScopes",
column: "ApiScopeId"); column: "ApiResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiScopes_ApiResourceId", name: "IX_ApiResourceSecrets_ApiResourceId",
table: "ApiScopes", table: "ApiResourceSecrets",
column: "ApiResourceId"); column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ScopeId",
table: "ApiScopeClaims",
column: "ScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopeProperties_ScopeId",
table: "ApiScopeProperties",
column: "ScopeId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ApiScopes_Name", name: "IX_ApiScopes_Name",
table: "ApiScopes", table: "ApiScopes",
column: "Name", column: "Name",
unique: true); unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiSecrets_ApiResourceId",
table: "ApiSecrets",
column: "ApiResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_ClientClaims_ClientId", name: "IX_ClientClaims_ClientId",
table: "ClientClaims", table: "ClientClaims",
@ -529,13 +573,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
column: "ClientId"); column: "ClientId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_IdentityClaims_IdentityResourceId", name: "IX_IdentityResourceClaims_IdentityResourceId",
table: "IdentityClaims", table: "IdentityResourceClaims",
column: "IdentityResourceId"); column: "IdentityResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_IdentityProperties_IdentityResourceId", name: "IX_IdentityResourceProperties_IdentityResourceId",
table: "IdentityProperties", table: "IdentityResourceProperties",
column: "IdentityResourceId"); column: "IdentityResourceId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
@ -548,16 +592,22 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApiClaims"); name: "ApiResourceClaims");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApiProperties"); name: "ApiResourceProperties");
migrationBuilder.DropTable(
name: "ApiResourceScopes");
migrationBuilder.DropTable(
name: "ApiResourceSecrets");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApiScopeClaims"); name: "ApiScopeClaims");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApiSecrets"); name: "ApiScopeProperties");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ClientClaims"); name: "ClientClaims");
@ -587,10 +637,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
name: "ClientSecrets"); name: "ClientSecrets");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "IdentityClaims"); name: "IdentityResourceClaims");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "IdentityProperties"); name: "IdentityResourceProperties");
migrationBuilder.DropTable(
name: "ApiResources");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ApiScopes"); name: "ApiScopes");
@ -600,9 +653,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "IdentityResources"); name: "IdentityResources");
migrationBuilder.DropTable(
name: "ApiResources");
} }
} }
} }

View File

@ -15,9 +15,9 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "3.1.3") .HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{ {
@ -26,16 +26,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AllowedAccessTokenSigningAlgorithms")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Created") b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(1000)") .HasMaxLength(1000)
.HasMaxLength(1000); .HasColumnType("character varying(1000)");
b.Property<string>("DisplayName") b.Property<string>("DisplayName")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("Enabled") b.Property<bool>("Enabled")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -45,12 +49,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("NonEditable") b.Property<bool>("NonEditable")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated") b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
@ -74,14 +81,14 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiResourceId"); b.HasIndex("ApiResourceId");
b.ToTable("ApiClaims"); b.ToTable("ApiResourceClaims");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
@ -96,22 +103,22 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Key") b.Property<string>("Key")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiResourceId"); 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<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -121,21 +128,80 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<int>("ApiResourceId") b.Property<int>("ApiResourceId")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(1000)") .HasMaxLength(1000)
.HasMaxLength(1000); .HasColumnType("character varying(1000)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("DisplayName") b.Property<string>("DisplayName")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("Emphasize") b.Property<bool>("Emphasize")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("Required") b.Property<bool>("Required")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -145,8 +211,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.HasIndex("Name") b.HasIndex("Name")
.IsUnique(); .IsUnique();
@ -160,56 +224,46 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiScopeId") b.Property<int>("ScopeId")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiScopeId"); b.HasIndex("ScopeId");
b.ToTable("ApiScopeClaims"); b.ToTable("ApiScopeClaims");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId") b.Property<string>("Key")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(4000)") .HasMaxLength(2000)
.HasMaxLength(4000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("ApiResourceId"); b.HasIndex("ScopeId");
b.ToTable("ApiSecrets"); b.ToTable("ApiScopeProperties");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b =>
@ -240,6 +294,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<bool>("AllowRememberConsent") b.Property<bool>("AllowRememberConsent")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("AllowedIdentityTokenSigningAlgorithms")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken") b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -253,25 +311,25 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri") b.Property<string>("BackChannelLogoutUri")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<string>("ClientClaimsPrefix") b.Property<string>("ClientClaimsPrefix")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientName") b.Property<string>("ClientName")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientUri") b.Property<string>("ClientUri")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<int?>("ConsentLifetime") b.Property<int?>("ConsentLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -280,8 +338,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(1000)") .HasMaxLength(1000)
.HasMaxLength(1000); .HasColumnType("character varying(1000)");
b.Property<int>("DeviceCodeLifetime") b.Property<int>("DeviceCodeLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -296,8 +354,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri") b.Property<string>("FrontChannelLogoutUri")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<int>("IdentityTokenLifetime") b.Property<int>("IdentityTokenLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -309,20 +367,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri") b.Property<string>("LogoUri")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<bool>("NonEditable") b.Property<bool>("NonEditable")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt") b.Property<string>("PairWiseSubjectSalt")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ProtocolType") b.Property<string>("ProtocolType")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<int>("RefreshTokenExpiration") b.Property<int>("RefreshTokenExpiration")
.HasColumnType("integer"); .HasColumnType("integer");
@ -339,6 +397,9 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<bool>("RequirePkce") b.Property<bool>("RequirePkce")
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<bool>("RequireRequestObject")
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime") b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -349,8 +410,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType") b.Property<string>("UserCodeType")
.HasColumnType("character varying(100)") .HasMaxLength(100)
.HasMaxLength(100); .HasColumnType("character varying(100)");
b.Property<int?>("UserSsoLifetime") b.Property<int?>("UserSsoLifetime")
.HasColumnType("integer"); .HasColumnType("integer");
@ -375,13 +436,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.HasKey("Id"); b.HasKey("Id");
@ -402,8 +463,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Origin") b.Property<string>("Origin")
.IsRequired() .IsRequired()
.HasColumnType("character varying(150)") .HasMaxLength(150)
.HasMaxLength(150); .HasColumnType("character varying(150)");
b.HasKey("Id"); b.HasKey("Id");
@ -424,8 +485,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("GrantType") b.Property<string>("GrantType")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.HasKey("Id"); b.HasKey("Id");
@ -446,8 +507,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Provider") b.Property<string>("Provider")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("Id"); b.HasKey("Id");
@ -468,8 +529,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("PostLogoutRedirectUri") b.Property<string>("PostLogoutRedirectUri")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
@ -490,13 +551,13 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Key") b.Property<string>("Key")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
@ -517,8 +578,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("RedirectUri") b.Property<string>("RedirectUri")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
@ -539,8 +600,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Scope") b.Property<string>("Scope")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("Id"); b.HasKey("Id");
@ -563,21 +624,21 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(4000)") .HasMaxLength(4000)
.HasMaxLength(4000); .HasColumnType("character varying(4000)");
b.HasKey("Id"); b.HasKey("Id");
@ -586,28 +647,6 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.ToTable("ClientSecrets"); b.ToTable("ClientSecrets");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -619,12 +658,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("character varying(1000)") .HasMaxLength(1000)
.HasMaxLength(1000); .HasColumnType("character varying(1000)");
b.Property<string>("DisplayName") b.Property<string>("DisplayName")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("Emphasize") b.Property<bool>("Emphasize")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -634,8 +673,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<bool>("NonEditable") b.Property<bool>("NonEditable")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -657,6 +696,28 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.ToTable("IdentityResources"); b.ToTable("IdentityResources");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -669,19 +730,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
b.Property<string>("Key") b.Property<string>("Key")
.IsRequired() .IsRequired()
.HasColumnType("character varying(250)") .HasMaxLength(250)
.HasMaxLength(250); .HasColumnType("character varying(250)");
b.Property<string>("Value") b.Property<string>("Value")
.IsRequired() .IsRequired()
.HasColumnType("character varying(2000)") .HasMaxLength(2000)
.HasMaxLength(2000); .HasColumnType("character varying(2000)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("IdentityResourceId"); b.HasIndex("IdentityResourceId");
b.ToTable("IdentityProperties"); b.ToTable("IdentityResourceProperties");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
@ -691,6 +752,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ApiResourceId") .HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("ApiResource");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
@ -700,33 +763,52 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ApiResourceId") .HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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") b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Scopes") .WithMany("Scopes")
.HasForeignKey("ApiResourceId") .HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("ApiResource");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b =>
{ {
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Secrets") .WithMany("Secrets")
.HasForeignKey("ApiResourceId") .HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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 => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
@ -736,6 +818,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
@ -745,6 +829,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
@ -754,6 +840,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
@ -763,6 +851,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
@ -772,6 +862,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
@ -781,6 +873,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
@ -790,6 +884,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
@ -799,6 +895,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Client");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
@ -808,15 +906,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("ClientId") .HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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") b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("UserClaims") .WithMany("UserClaims")
.HasForeignKey("IdentityResourceId") .HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("IdentityResource");
}); });
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
@ -826,6 +928,54 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
.HasForeignKey("IdentityResourceId") .HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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 #pragma warning restore 612, 618
} }

View File

@ -7,51 +7,59 @@ using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase namespace Kyoo.Kyoo.Models.DatabaseMigrations.IdentityDatbase
{ {
[DbContext(typeof(IdentityDatabase))] [DbContext(typeof(IdentityDatabase))]
[Migration("20200526235424_Initial")] [Migration("20210216205030_Initial")]
partial class Initial partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "3.1.3") .HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("character varying(50000)") .HasMaxLength(50000)
.HasMaxLength(50000); .HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired() .IsRequired()
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -66,33 +74,44 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<DateTime?>("ConsumedTime")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("character varying(50000)") .HasMaxLength(50000)
.HasMaxLength(50000); .HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(50)") .HasMaxLength(50)
.HasMaxLength(50); .HasColumnType("character varying(50)");
b.HasKey("Key"); b.HasKey("Key");
@ -100,6 +119,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type");
b.HasIndex("SubjectId", "SessionId", "Type");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
@ -116,8 +137,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed") b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -129,12 +150,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("OTAC") b.Property<string>("OTAC")
.HasColumnType("text"); .HasColumnType("text");
@ -158,17 +179,17 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedEmail") b.HasIndex("NormalizedEmail")
.HasName("EmailIndex"); .HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName") b.HasIndex("NormalizedUserName")
.IsUnique() .IsUnique()
.HasName("UserNameIndex"); .HasDatabaseName("UserNameIndex");
b.ToTable("User"); b.ToTable("User");
}); });
@ -183,18 +204,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedName") b.HasIndex("NormalizedName")
.IsUnique() .IsUnique()
.HasName("RoleNameIndex"); .HasDatabaseName("RoleNameIndex");
b.ToTable("UserRoles"); b.ToTable("UserRoles");
}); });
@ -250,12 +271,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("character varying(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("character varying(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("ProviderDisplayName") b.Property<string>("ProviderDisplayName")
.HasColumnType("text"); .HasColumnType("text");
@ -292,12 +313,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("character varying(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("character varying(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("Value") b.Property<string>("Value")
.HasColumnType("text"); .HasColumnType("text");

View File

@ -2,7 +2,7 @@
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase namespace Kyoo.Kyoo.Models.DatabaseMigrations.IdentityDatbase
{ {
public partial class Initial : Migration public partial class Initial : Migration
{ {
@ -12,13 +12,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
name: "DeviceCodes", name: "DeviceCodes",
columns: table => new columns: table => new
{ {
UserCode = table.Column<string>(maxLength: 200, nullable: false), UserCode = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DeviceCode = table.Column<string>(maxLength: 200, nullable: false), DeviceCode = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
SubjectId = table.Column<string>(maxLength: 200, nullable: true), SubjectId = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
ClientId = table.Column<string>(maxLength: 200, nullable: false), SessionId = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
CreationTime = table.Column<DateTime>(nullable: false), ClientId = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
Expiration = table.Column<DateTime>(nullable: false), Description = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Data = table.Column<string>(maxLength: 50000, nullable: false) CreationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Expiration = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Data = table.Column<string>(type: "character varying(50000)", maxLength: 50000, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -29,13 +31,16 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
name: "PersistedGrants", name: "PersistedGrants",
columns: table => new columns: table => new
{ {
Key = table.Column<string>(maxLength: 200, nullable: false), Key = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
Type = table.Column<string>(maxLength: 50, nullable: false), Type = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
SubjectId = table.Column<string>(maxLength: 200, nullable: true), SubjectId = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
ClientId = table.Column<string>(maxLength: 200, nullable: false), SessionId = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
CreationTime = table.Column<DateTime>(nullable: false), ClientId = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
Expiration = table.Column<DateTime>(nullable: true), Description = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Data = table.Column<string>(maxLength: 50000, nullable: false) CreationTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Expiration = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
ConsumedTime = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Data = table.Column<string>(type: "character varying(50000)", maxLength: 50000, nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -46,23 +51,23 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
name: "User", name: "User",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<string>(type: "text", nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true), OTAC = table.Column<string>(type: "text", nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true), OTACExpires = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true), UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true), NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false), Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
PasswordHash = table.Column<string>(nullable: true), NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
SecurityStamp = table.Column<string>(nullable: true), EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
ConcurrencyStamp = table.Column<string>(nullable: true), PasswordHash = table.Column<string>(type: "text", nullable: true),
PhoneNumber = table.Column<string>(nullable: true), SecurityStamp = table.Column<string>(type: "text", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false), ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
TwoFactorEnabled = table.Column<bool>(nullable: false), PhoneNumber = table.Column<string>(type: "text", nullable: true),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true), PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
LockoutEnabled = table.Column<bool>(nullable: false), TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
AccessFailedCount = table.Column<int>(nullable: false), LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
OTAC = table.Column<string>(nullable: true), LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
OTACExpires = table.Column<DateTime>(nullable: true) AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -73,10 +78,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
name: "UserRoles", name: "UserRoles",
columns: table => new columns: table => new
{ {
Id = table.Column<string>(nullable: false), Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(maxLength: 256, nullable: true), Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true), NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true) ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -87,11 +92,11 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
name: "UserClaim", name: "UserClaim",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(nullable: true) ClaimValue = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -108,10 +113,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
name: "UserLogin", name: "UserLogin",
columns: table => new columns: table => new
{ {
LoginProvider = table.Column<string>(maxLength: 128, nullable: false), LoginProvider = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
ProviderKey = table.Column<string>(maxLength: 128, nullable: false), ProviderKey = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true), ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
UserId = table.Column<string>(nullable: false) UserId = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -128,10 +133,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
name: "UserToken", name: "UserToken",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
LoginProvider = table.Column<string>(maxLength: 128, nullable: false), LoginProvider = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
Name = table.Column<string>(maxLength: 128, nullable: false), Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
Value = table.Column<string>(nullable: true) Value = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -148,35 +153,35 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
name: "UserRole", name: "UserRole",
columns: table => new columns: table => new
{ {
UserId = table.Column<string>(nullable: false), UserId = table.Column<string>(type: "text", nullable: false),
RoleId = table.Column<string>(nullable: false) RoleId = table.Column<string>(type: "text", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_UserRole", x => new { x.UserId, x.RoleId }); 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( table.ForeignKey(
name: "FK_UserRole_User_UserId", name: "FK_UserRole_User_UserId",
column: x => x.UserId, column: x => x.UserId,
principalTable: "User", principalTable: "User",
principalColumn: "Id", principalColumn: "Id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_UserRole_UserRoles_RoleId",
column: x => x.RoleId,
principalTable: "UserRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "UserRoleClaim", name: "UserRoleClaim",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(nullable: false) Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoleId = table.Column<string>(nullable: false), RoleId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(nullable: true), ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(nullable: true) ClaimValue = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -210,6 +215,11 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
table: "PersistedGrants", table: "PersistedGrants",
columns: new[] { "SubjectId", "ClientId", "Type" }); columns: new[] { "SubjectId", "ClientId", "Type" });
migrationBuilder.CreateIndex(
name: "IX_PersistedGrants_SubjectId_SessionId_Type",
table: "PersistedGrants",
columns: new[] { "SubjectId", "SessionId", "Type" });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "EmailIndex", name: "EmailIndex",
table: "User", table: "User",

View File

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase namespace Kyoo.Kyoo.Models.DatabaseMigrations.IdentityDatbase
{ {
[DbContext(typeof(IdentityDatabase))] [DbContext(typeof(IdentityDatabase))]
partial class IdentityDatabaseModelSnapshot : ModelSnapshot partial class IdentityDatabaseModelSnapshot : ModelSnapshot
@ -15,41 +15,49 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "3.1.3") .HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{ {
b.Property<string>("UserCode") b.Property<string>("UserCode")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("character varying(50000)") .HasMaxLength(50000)
.HasMaxLength(50000); .HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("DeviceCode") b.Property<string>("DeviceCode")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.IsRequired() .IsRequired()
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.HasKey("UserCode"); b.HasKey("UserCode");
@ -64,33 +72,44 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{ {
b.Property<string>("Key") b.Property<string>("Key")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("ClientId") b.Property<string>("ClientId")
.IsRequired() .IsRequired()
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<DateTime?>("ConsumedTime")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("Data") b.Property<string>("Data")
.IsRequired() .IsRequired()
.HasColumnType("character varying(50000)") .HasMaxLength(50000)
.HasMaxLength(50000); .HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration") b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId") b.Property<string>("SubjectId")
.HasColumnType("character varying(200)") .HasMaxLength(200)
.HasMaxLength(200); .HasColumnType("character varying(200)");
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasColumnType("character varying(50)") .HasMaxLength(50)
.HasMaxLength(50); .HasColumnType("character varying(50)");
b.HasKey("Key"); b.HasKey("Key");
@ -98,6 +117,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
b.HasIndex("SubjectId", "ClientId", "Type"); b.HasIndex("SubjectId", "ClientId", "Type");
b.HasIndex("SubjectId", "SessionId", "Type");
b.ToTable("PersistedGrants"); b.ToTable("PersistedGrants");
}); });
@ -114,8 +135,8 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Email") b.Property<string>("Email")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed") b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -127,12 +148,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail") b.Property<string>("NormalizedEmail")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName") b.Property<string>("NormalizedUserName")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("OTAC") b.Property<string>("OTAC")
.HasColumnType("text"); .HasColumnType("text");
@ -156,17 +177,17 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("boolean"); .HasColumnType("boolean");
b.Property<string>("UserName") b.Property<string>("UserName")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedEmail") b.HasIndex("NormalizedEmail")
.HasName("EmailIndex"); .HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName") b.HasIndex("NormalizedUserName")
.IsUnique() .IsUnique()
.HasName("UserNameIndex"); .HasDatabaseName("UserNameIndex");
b.ToTable("User"); b.ToTable("User");
}); });
@ -181,18 +202,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.Property<string>("NormalizedName") b.Property<string>("NormalizedName")
.HasColumnType("character varying(256)") .HasMaxLength(256)
.HasMaxLength(256); .HasColumnType("character varying(256)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("NormalizedName") b.HasIndex("NormalizedName")
.IsUnique() .IsUnique()
.HasName("RoleNameIndex"); .HasDatabaseName("RoleNameIndex");
b.ToTable("UserRoles"); b.ToTable("UserRoles");
}); });
@ -248,12 +269,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("character varying(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasColumnType("character varying(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("ProviderDisplayName") b.Property<string>("ProviderDisplayName")
.HasColumnType("text"); .HasColumnType("text");
@ -290,12 +311,12 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasColumnType("character varying(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("character varying(128)") .HasMaxLength(128)
.HasMaxLength(128); .HasColumnType("character varying(128)");
b.Property<string>("Value") b.Property<string>("Value")
.HasColumnType("text"); .HasColumnType("text");

View File

@ -1,6 +1,5 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using System.Collections.Generic;
using Kyoo; using Kyoo;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
@ -8,22 +7,22 @@ using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal namespace Kyoo.Kyoo.Models.DatabaseMigrations.Internal
{ {
[DbContext(typeof(DatabaseContext))] [DbContext(typeof(DatabaseContext))]
[Migration("20210128212212_Initial")] [Migration("20210216202218_Initial")]
partial class Initial partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Npgsql:Enum:item_type", "show,movie,collection") .HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" })
.HasAnnotation("Npgsql:Enum:status", "finished,airing,planned,unknown") .HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" })
.HasAnnotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,font") .HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "font" })
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "3.1.3") .HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("Kyoo.Models.CollectionDE", b => modelBuilder.Entity("Kyoo.Models.CollectionDE", b =>
{ {
@ -51,8 +50,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.IsUnique(); .IsUnique();
b.ToTable("Collections"); b.ToTable("Collections");
b.HasDiscriminator();
}); });
modelBuilder.Entity("Kyoo.Models.CollectionLink", b => modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
@ -140,8 +137,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.IsUnique(); .IsUnique();
b.ToTable("Genres"); b.ToTable("Genres");
b.HasDiscriminator();
}); });
modelBuilder.Entity("Kyoo.Models.GenreLink", b => modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
@ -169,7 +164,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("text"); .HasColumnType("text");
b.Property<IEnumerable<string>>("Paths") b.Property<string[]>("Paths")
.HasColumnType("text[]"); .HasColumnType("text[]");
b.Property<string>("Slug") b.Property<string>("Slug")
@ -182,8 +177,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.IsUnique(); .IsUnique();
b.ToTable("Libraries"); b.ToTable("Libraries");
b.HasDiscriminator();
}); });
modelBuilder.Entity("Kyoo.Models.LibraryLink", b => modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
@ -393,7 +386,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<IEnumerable<string>>("Aliases") b.Property<string[]>("Aliases")
.HasColumnType("text[]"); .HasColumnType("text[]");
b.Property<string>("Backdrop") b.Property<string>("Backdrop")
@ -444,8 +437,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.HasIndex("StudioID"); b.HasIndex("StudioID");
b.ToTable("Shows"); b.ToTable("Shows");
b.HasDiscriminator();
}); });
modelBuilder.Entity("Kyoo.Models.Studio", b => modelBuilder.Entity("Kyoo.Models.Studio", b =>
@ -524,6 +515,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ParentID") .HasForeignKey("ParentID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Child");
b.Navigation("Parent");
}); });
modelBuilder.Entity("Kyoo.Models.Episode", b => modelBuilder.Entity("Kyoo.Models.Episode", b =>
@ -537,6 +532,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Season");
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.GenreLink", b => modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
@ -552,6 +551,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ParentID") .HasForeignKey("ParentID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Child");
b.Navigation("Parent");
}); });
modelBuilder.Entity("Kyoo.Models.LibraryLink", b => modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
@ -571,6 +574,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.WithMany("LibraryLinks") .WithMany("LibraryLinks")
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.Navigation("Collection");
b.Navigation("Library");
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
@ -600,6 +609,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.Navigation("Episode");
b.Navigation("People");
b.Navigation("Provider");
b.Navigation("Season");
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.PeopleRole", b => modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
@ -615,6 +634,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("People");
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.ProviderLink", b => modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
@ -630,6 +653,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ParentID") .HasForeignKey("ParentID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Child");
b.Navigation("Parent");
}); });
modelBuilder.Entity("Kyoo.Models.Season", b => modelBuilder.Entity("Kyoo.Models.Season", b =>
@ -639,6 +666,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.ShowDE", b => modelBuilder.Entity("Kyoo.Models.ShowDE", b =>
@ -646,6 +675,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.HasOne("Kyoo.Models.Studio", "Studio") b.HasOne("Kyoo.Models.Studio", "Studio")
.WithMany() .WithMany()
.HasForeignKey("StudioID"); .HasForeignKey("StudioID");
b.Navigation("Studio");
}); });
modelBuilder.Entity("Kyoo.Models.Track", b => modelBuilder.Entity("Kyoo.Models.Track", b =>
@ -655,6 +686,65 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("EpisodeID") .HasForeignKey("EpisodeID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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 #pragma warning restore 612, 618
} }

View File

@ -2,7 +2,7 @@
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal namespace Kyoo.Kyoo.Models.DatabaseMigrations.Internal
{ {
public partial class Initial : Migration public partial class Initial : Migration
{ {
@ -17,12 +17,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "Collections", name: "Collections",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: false), Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(nullable: true), Name = table.Column<string>(type: "text", nullable: true),
Poster = table.Column<string>(nullable: true), Poster = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(nullable: true) Overview = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -33,10 +33,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "Genres", name: "Genres",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: false), Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(nullable: true) Name = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -47,10 +47,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "Libraries", name: "Libraries",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: false), Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(nullable: true), Name = table.Column<string>(type: "text", nullable: true),
Paths = table.Column<string[]>(type: "text[]", nullable: true) Paths = table.Column<string[]>(type: "text[]", nullable: true)
}, },
constraints: table => constraints: table =>
@ -62,11 +62,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "People", name: "People",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: false), Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(nullable: true), Name = table.Column<string>(type: "text", nullable: true),
Poster = table.Column<string>(nullable: true) Poster = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -77,11 +77,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "Providers", name: "Providers",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: false), Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(nullable: true), Name = table.Column<string>(type: "text", nullable: true),
Logo = table.Column<string>(nullable: true) Logo = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -92,10 +92,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "Studios", name: "Studios",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: false), Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(nullable: true) Name = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -106,46 +106,46 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "ProviderLinks", name: "ProviderLinks",
columns: table => new columns: table => new
{ {
ParentID = table.Column<int>(nullable: false), ParentID = table.Column<int>(type: "integer", nullable: false),
ChildID = table.Column<int>(nullable: false) ChildID = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_ProviderLinks", x => new { x.ParentID, x.ChildID }); 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( table.ForeignKey(
name: "FK_ProviderLinks_Libraries_ParentID", name: "FK_ProviderLinks_Libraries_ParentID",
column: x => x.ParentID, column: x => x.ParentID,
principalTable: "Libraries", principalTable: "Libraries",
principalColumn: "ID", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProviderLinks_Providers_ChildID",
column: x => x.ChildID,
principalTable: "Providers",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Shows", name: "Shows",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: false), Slug = table.Column<string>(type: "text", nullable: false),
Title = table.Column<string>(nullable: true), Title = table.Column<string>(type: "text", nullable: true),
Aliases = table.Column<string[]>(type: "text[]", nullable: true), Aliases = table.Column<string[]>(type: "text[]", nullable: true),
Path = table.Column<string>(nullable: true), Path = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(nullable: true), Overview = table.Column<string>(type: "text", nullable: true),
Status = table.Column<int>(nullable: true), Status = table.Column<int>(type: "integer", nullable: true),
TrailerUrl = table.Column<string>(nullable: true), TrailerUrl = table.Column<string>(type: "text", nullable: true),
StartYear = table.Column<int>(nullable: true), StartYear = table.Column<int>(type: "integer", nullable: true),
EndYear = table.Column<int>(nullable: true), EndYear = table.Column<int>(type: "integer", nullable: true),
Poster = table.Column<string>(nullable: true), Poster = table.Column<string>(type: "text", nullable: true),
Logo = table.Column<string>(nullable: true), Logo = table.Column<string>(type: "text", nullable: true),
Backdrop = table.Column<string>(nullable: true), Backdrop = table.Column<string>(type: "text", nullable: true),
IsMovie = table.Column<bool>(nullable: false), IsMovie = table.Column<bool>(type: "boolean", nullable: false),
StudioID = table.Column<int>(nullable: true) StudioID = table.Column<int>(type: "integer", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -162,32 +162,32 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "CollectionLinks", name: "CollectionLinks",
columns: table => new columns: table => new
{ {
ParentID = table.Column<int>(nullable: false), ParentID = table.Column<int>(type: "integer", nullable: false),
ChildID = table.Column<int>(nullable: false) ChildID = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_CollectionLinks", x => new { x.ParentID, x.ChildID }); 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( table.ForeignKey(
name: "FK_CollectionLinks_Collections_ParentID", name: "FK_CollectionLinks_Collections_ParentID",
column: x => x.ParentID, column: x => x.ParentID,
principalTable: "Collections", principalTable: "Collections",
principalColumn: "ID", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CollectionLinks_Shows_ChildID",
column: x => x.ChildID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "GenreLinks", name: "GenreLinks",
columns: table => new columns: table => new
{ {
ParentID = table.Column<int>(nullable: false), ParentID = table.Column<int>(type: "integer", nullable: false),
ChildID = table.Column<int>(nullable: false) ChildID = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -210,11 +210,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "LibraryLinks", name: "LibraryLinks",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
LibraryID = table.Column<int>(nullable: false), LibraryID = table.Column<int>(type: "integer", nullable: false),
ShowID = table.Column<int>(nullable: true), ShowID = table.Column<int>(type: "integer", nullable: true),
CollectionID = table.Column<int>(nullable: true) CollectionID = table.Column<int>(type: "integer", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -243,12 +243,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "PeopleRoles", name: "PeopleRoles",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PeopleID = table.Column<int>(nullable: false), PeopleID = table.Column<int>(type: "integer", nullable: false),
ShowID = table.Column<int>(nullable: false), ShowID = table.Column<int>(type: "integer", nullable: false),
Role = table.Column<string>(nullable: true), Role = table.Column<string>(type: "text", nullable: true),
Type = table.Column<string>(nullable: true) Type = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -271,14 +271,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "Seasons", name: "Seasons",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ShowID = table.Column<int>(nullable: false), ShowID = table.Column<int>(type: "integer", nullable: false),
SeasonNumber = table.Column<int>(nullable: false), SeasonNumber = table.Column<int>(type: "integer", nullable: false),
Title = table.Column<string>(nullable: true), Title = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(nullable: true), Overview = table.Column<string>(type: "text", nullable: true),
Year = table.Column<int>(nullable: true), Year = table.Column<int>(type: "integer", nullable: true),
Poster = table.Column<string>(nullable: true) Poster = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -295,19 +295,19 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "Episodes", name: "Episodes",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ShowID = table.Column<int>(nullable: false), ShowID = table.Column<int>(type: "integer", nullable: false),
SeasonID = table.Column<int>(nullable: true), SeasonID = table.Column<int>(type: "integer", nullable: true),
SeasonNumber = table.Column<int>(nullable: false), SeasonNumber = table.Column<int>(type: "integer", nullable: false),
EpisodeNumber = table.Column<int>(nullable: false), EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
AbsoluteNumber = table.Column<int>(nullable: false), AbsoluteNumber = table.Column<int>(type: "integer", nullable: false),
Path = table.Column<string>(nullable: true), Path = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(nullable: true), Title = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(nullable: true), Overview = table.Column<string>(type: "text", nullable: true),
ReleaseDate = table.Column<DateTime>(nullable: true), ReleaseDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Runtime = table.Column<int>(nullable: false), Runtime = table.Column<int>(type: "integer", nullable: false),
Poster = table.Column<string>(nullable: true) Poster = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -330,15 +330,15 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "MetadataIds", name: "MetadataIds",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProviderID = table.Column<int>(nullable: false), ProviderID = table.Column<int>(type: "integer", nullable: false),
ShowID = table.Column<int>(nullable: true), ShowID = table.Column<int>(type: "integer", nullable: true),
EpisodeID = table.Column<int>(nullable: true), EpisodeID = table.Column<int>(type: "integer", nullable: true),
SeasonID = table.Column<int>(nullable: true), SeasonID = table.Column<int>(type: "integer", nullable: true),
PeopleID = table.Column<int>(nullable: true), PeopleID = table.Column<int>(type: "integer", nullable: true),
DataID = table.Column<string>(nullable: true), DataID = table.Column<string>(type: "text", nullable: true),
Link = table.Column<string>(nullable: true) Link = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -379,17 +379,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "Tracks", name: "Tracks",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Title = table.Column<string>(nullable: true), EpisodeID = table.Column<int>(type: "integer", nullable: false),
Language = table.Column<string>(nullable: true), IsDefault = table.Column<bool>(type: "boolean", nullable: false),
Codec = table.Column<string>(nullable: true), IsForced = table.Column<bool>(type: "boolean", nullable: false),
Path = table.Column<string>(nullable: true), IsExternal = table.Column<bool>(type: "boolean", nullable: false),
Type = table.Column<int>(nullable: false), Title = table.Column<string>(type: "text", nullable: true),
EpisodeID = table.Column<int>(nullable: false), Language = table.Column<string>(type: "text", nullable: true),
IsDefault = table.Column<bool>(nullable: false), Codec = table.Column<string>(type: "text", nullable: true),
IsForced = table.Column<bool>(nullable: false), Path = table.Column<string>(type: "text", nullable: true),
IsExternal = table.Column<bool>(nullable: false) Type = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -446,11 +446,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
table: "LibraryLinks", table: "LibraryLinks",
column: "CollectionID"); column: "CollectionID");
migrationBuilder.CreateIndex(
name: "IX_LibraryLinks_ShowID",
table: "LibraryLinks",
column: "ShowID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_LibraryLinks_LibraryID_CollectionID", name: "IX_LibraryLinks_LibraryID_CollectionID",
table: "LibraryLinks", table: "LibraryLinks",
@ -463,6 +458,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: new[] { "LibraryID", "ShowID" }, columns: new[] { "LibraryID", "ShowID" },
unique: true); unique: true);
migrationBuilder.CreateIndex(
name: "IX_LibraryLinks_ShowID",
table: "LibraryLinks",
column: "ShowID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_EpisodeID", name: "IX_MetadataIds_EpisodeID",
table: "MetadataIds", table: "MetadataIds",
@ -577,10 +577,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
name: "People"); name: "People");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Providers"); name: "Libraries");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Libraries"); name: "Providers");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Episodes"); name: "Episodes");

View File

@ -1,13 +1,12 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using System.Collections.Generic;
using Kyoo; using Kyoo;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal namespace Kyoo.Kyoo.Models.DatabaseMigrations.Internal
{ {
[DbContext(typeof(DatabaseContext))] [DbContext(typeof(DatabaseContext))]
partial class DatabaseContextModelSnapshot : ModelSnapshot partial class DatabaseContextModelSnapshot : ModelSnapshot
@ -16,12 +15,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Npgsql:Enum:item_type", "show,movie,collection") .HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" })
.HasAnnotation("Npgsql:Enum:status", "finished,airing,planned,unknown") .HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" })
.HasAnnotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,font") .HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "font" })
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "3.1.3") .HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("Kyoo.Models.CollectionDE", b => modelBuilder.Entity("Kyoo.Models.CollectionDE", b =>
{ {
@ -49,8 +48,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.IsUnique(); .IsUnique();
b.ToTable("Collections"); b.ToTable("Collections");
b.HasDiscriminator();
}); });
modelBuilder.Entity("Kyoo.Models.CollectionLink", b => modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
@ -138,8 +135,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.IsUnique(); .IsUnique();
b.ToTable("Genres"); b.ToTable("Genres");
b.HasDiscriminator();
}); });
modelBuilder.Entity("Kyoo.Models.GenreLink", b => modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
@ -167,7 +162,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("text"); .HasColumnType("text");
b.Property<IEnumerable<string>>("Paths") b.Property<string[]>("Paths")
.HasColumnType("text[]"); .HasColumnType("text[]");
b.Property<string>("Slug") b.Property<string>("Slug")
@ -180,8 +175,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.IsUnique(); .IsUnique();
b.ToTable("Libraries"); b.ToTable("Libraries");
b.HasDiscriminator();
}); });
modelBuilder.Entity("Kyoo.Models.LibraryLink", b => modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
@ -391,7 +384,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<IEnumerable<string>>("Aliases") b.Property<string[]>("Aliases")
.HasColumnType("text[]"); .HasColumnType("text[]");
b.Property<string>("Backdrop") b.Property<string>("Backdrop")
@ -442,8 +435,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.HasIndex("StudioID"); b.HasIndex("StudioID");
b.ToTable("Shows"); b.ToTable("Shows");
b.HasDiscriminator();
}); });
modelBuilder.Entity("Kyoo.Models.Studio", b => modelBuilder.Entity("Kyoo.Models.Studio", b =>
@ -522,6 +513,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ParentID") .HasForeignKey("ParentID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Child");
b.Navigation("Parent");
}); });
modelBuilder.Entity("Kyoo.Models.Episode", b => modelBuilder.Entity("Kyoo.Models.Episode", b =>
@ -535,6 +530,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Season");
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.GenreLink", b => modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
@ -550,6 +549,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ParentID") .HasForeignKey("ParentID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Child");
b.Navigation("Parent");
}); });
modelBuilder.Entity("Kyoo.Models.LibraryLink", b => modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
@ -569,6 +572,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.WithMany("LibraryLinks") .WithMany("LibraryLinks")
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.Navigation("Collection");
b.Navigation("Library");
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
@ -598,6 +607,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
b.Navigation("Episode");
b.Navigation("People");
b.Navigation("Provider");
b.Navigation("Season");
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.PeopleRole", b => modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
@ -613,6 +632,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("People");
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.ProviderLink", b => modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
@ -628,6 +651,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ParentID") .HasForeignKey("ParentID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Child");
b.Navigation("Parent");
}); });
modelBuilder.Entity("Kyoo.Models.Season", b => modelBuilder.Entity("Kyoo.Models.Season", b =>
@ -637,6 +664,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("ShowID") .HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.Navigation("Show");
}); });
modelBuilder.Entity("Kyoo.Models.ShowDE", b => modelBuilder.Entity("Kyoo.Models.ShowDE", b =>
@ -644,6 +673,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.HasOne("Kyoo.Models.Studio", "Studio") b.HasOne("Kyoo.Models.Studio", "Studio")
.WithMany() .WithMany()
.HasForeignKey("StudioID"); .HasForeignKey("StudioID");
b.Navigation("Studio");
}); });
modelBuilder.Entity("Kyoo.Models.Track", b => modelBuilder.Entity("Kyoo.Models.Track", b =>
@ -653,6 +684,65 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("EpisodeID") .HasForeignKey("EpisodeID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .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 #pragma warning restore 612, 618
} }

View File

@ -11,6 +11,7 @@ using Microsoft.Extensions.Options;
namespace Kyoo namespace Kyoo
{ {
// The configuration's database is named ConfigurationDbContext.
public class IdentityDatabase : IdentityDbContext<User>, IPersistedGrantDbContext public class IdentityDatabase : IdentityDbContext<User>, IPersistedGrantDbContext
{ {
private readonly IOptions<OperationalStoreOptions> _operationalStoreOptions; private readonly IOptions<OperationalStoreOptions> _operationalStoreOptions;

View File

@ -146,8 +146,8 @@ namespace Kyoo
services.AddScoped<IStudioRepository, StudioRepository>(); services.AddScoped<IStudioRepository, StudioRepository>();
services.AddScoped<IGenreRepository, GenreRepository>(); services.AddScoped<IGenreRepository, GenreRepository>();
services.AddScoped<IProviderRepository, ProviderRepository>(); services.AddScoped<IProviderRepository, ProviderRepository>();
// services.AddScoped<ILibraryManager, LibraryManager>(); services.AddScoped<ILibraryManager, LibraryManager>();
services.AddSingleton<ITranscoder, Transcoder>(); services.AddSingleton<ITranscoder, Transcoder>();
services.AddSingleton<IThumbnailsManager, ThumbnailsManager>(); services.AddSingleton<IThumbnailsManager, ThumbnailsManager>();
services.AddSingleton<IProviderManager, ProviderManager>(); services.AddSingleton<IProviderManager, ProviderManager>();

View File

@ -28,9 +28,9 @@ namespace Kyoo.Tasks
IdentityDatabase identityDatabase = serviceScope.ServiceProvider.GetService<IdentityDatabase>(); IdentityDatabase identityDatabase = serviceScope.ServiceProvider.GetService<IdentityDatabase>();
ConfigurationDbContext identityContext = serviceScope.ServiceProvider.GetService<ConfigurationDbContext>(); ConfigurationDbContext identityContext = serviceScope.ServiceProvider.GetService<ConfigurationDbContext>();
databaseContext.Database.Migrate(); databaseContext!.Database.Migrate();
identityDatabase.Database.Migrate(); identityDatabase!.Database.Migrate();
identityContext.Database.Migrate(); identityContext!.Database.Migrate();
if (!identityContext.Clients.Any()) if (!identityContext.Clients.Any())
{ {