Replacing sqlite with postgres

This commit is contained in:
Zoe Roux 2020-05-30 18:08:42 +02:00
parent 3684ea73f3
commit 28d48e9daf
14 changed files with 733 additions and 704 deletions

View File

@ -25,6 +25,7 @@
<PackageReference Include="IdentityServer4.EntityFramework.Storage" Version="3.1.2" />
<PackageReference Include="IdentityServer4.Storage" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.6.7" />
<ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
@ -42,7 +43,6 @@
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

View File

@ -5,52 +5,56 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
{
[DbContext(typeof(ConfigurationDbContext))]
[Migration("20200413152957_Initial")]
[Migration("20200526235342_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.3");
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Enabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
@ -64,14 +68,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -85,19 +90,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
@ -111,32 +117,33 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Required")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.HasKey("Id");
@ -152,14 +159,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiScopeId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -173,29 +181,30 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
@ -209,143 +218,144 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteRefreshTokenLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<int>("AccessTokenLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<int>("AccessTokenType")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("AllowAccessTokensViaBrowser")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AllowOfflineAccess")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AllowPlainTextPkce")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AllowRememberConsent")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AlwaysSendClientClaims")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<int>("AuthorizationCodeLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("BackChannelLogoutSessionRequired")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<int>("DeviceCodeLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("EnableLocalLogin")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("FrontChannelLogoutSessionRequired")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("IncludeJwtId")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<bool>("NonEditable")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<int>("RefreshTokenUsage")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("RequireClientSecret")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("RequireConsent")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("RequirePkce")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType")
.HasColumnType("TEXT")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<int?>("UserSsoLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.HasKey("Id");
@ -359,19 +369,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
@ -385,14 +396,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Origin")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(150)")
.HasMaxLength(150);
b.HasKey("Id");
@ -406,14 +418,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("GrantType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
@ -427,14 +440,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Provider")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -448,14 +462,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
@ -469,19 +484,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
@ -495,14 +511,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("RedirectUri")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
@ -516,14 +533,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -537,29 +555,30 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
@ -573,14 +592,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -594,41 +614,42 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("Required")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
@ -642,19 +663,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");

View File

@ -1,7 +1,8 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
{
public partial class Initial : Migration
{
@ -12,7 +13,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
@ -32,7 +33,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
ProtocolType = table.Column<string>(maxLength: 200, nullable: false),
@ -85,7 +86,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
@ -107,7 +108,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
@ -127,7 +128,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
@ -148,7 +149,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
@ -173,7 +174,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Value = table.Column<string>(maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(nullable: true),
@ -197,7 +198,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 250, nullable: false),
ClientId = table.Column<int>(nullable: false)
@ -218,7 +219,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Origin = table.Column<string>(maxLength: 150, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
@ -238,7 +239,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
GrantType = table.Column<string>(maxLength: 250, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
@ -258,7 +259,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Provider = table.Column<string>(maxLength: 200, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
@ -278,7 +279,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PostLogoutRedirectUri = table.Column<string>(maxLength: 2000, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
@ -298,7 +299,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
ClientId = table.Column<int>(nullable: false)
@ -319,7 +320,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RedirectUri = table.Column<string>(maxLength: 2000, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
@ -339,7 +340,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Scope = table.Column<string>(maxLength: 200, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
@ -359,7 +360,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Description = table.Column<string>(maxLength: 2000, nullable: true),
Value = table.Column<string>(maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(nullable: true),
@ -383,7 +384,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false),
IdentityResourceId = table.Column<int>(nullable: false)
},
@ -403,7 +404,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
IdentityResourceId = table.Column<int>(nullable: false)
@ -424,7 +425,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false),
ApiScopeId = table.Column<int>(nullable: false)
},

View File

@ -4,8 +4,9 @@ using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
{
[DbContext(typeof(ConfigurationDbContext))]
partial class ConfigurationDbContextModelSnapshot : ModelSnapshot
@ -14,41 +15,44 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.3");
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Enabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
@ -62,14 +66,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -83,19 +88,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
@ -109,32 +115,33 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Required")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.HasKey("Id");
@ -150,14 +157,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiScopeId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -171,29 +179,30 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
@ -207,143 +216,144 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteRefreshTokenLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<int>("AccessTokenLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<int>("AccessTokenType")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("AllowAccessTokensViaBrowser")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AllowOfflineAccess")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AllowPlainTextPkce")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AllowRememberConsent")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("AlwaysSendClientClaims")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<int>("AuthorizationCodeLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("BackChannelLogoutSessionRequired")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<int>("DeviceCodeLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("EnableLocalLogin")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("FrontChannelLogoutSessionRequired")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("IncludeJwtId")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<bool>("NonEditable")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<int>("RefreshTokenUsage")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("RequireClientSecret")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("RequireConsent")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("RequirePkce")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType")
.HasColumnType("TEXT")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<int?>("UserSsoLifetime")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.HasKey("Id");
@ -357,19 +367,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
@ -383,14 +394,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Origin")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(150)")
.HasMaxLength(150);
b.HasKey("Id");
@ -404,14 +416,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("GrantType")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
@ -425,14 +438,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Provider")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -446,14 +460,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
@ -467,19 +482,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
@ -493,14 +509,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("RedirectUri")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
@ -514,14 +531,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -535,29 +553,30 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
@ -571,14 +590,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
@ -592,41 +612,42 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("TEXT")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("Required")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
@ -640,19 +661,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");

View File

@ -5,49 +5,52 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{
[DbContext(typeof(IdentityDatabase))]
[Migration("20200413153045_Initial")]
[Migration("20200526235424_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.3");
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(50000)")
.HasMaxLength(50000);
b.Property<string>("DeviceCode")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("UserCode");
@ -63,32 +66,32 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(50000)")
.HasMaxLength(50000);
b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(50)")
.HasMaxLength(50);
b.HasKey("Key");
@ -103,59 +106,59 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Kyoo.Models.User", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Email")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("OTAC")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<DateTime?>("OTACExpires")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.HasKey("Id");
@ -173,18 +176,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.HasKey("Id");
@ -200,17 +203,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("Id");
@ -223,17 +227,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("Id");
@ -245,19 +250,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
@ -269,10 +274,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
@ -284,18 +289,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("Value")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -1,5 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{
@ -87,7 +88,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)
@ -172,7 +173,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoleId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)

View File

@ -4,6 +4,7 @@ using Kyoo;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{
@ -14,38 +15,40 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.3");
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(50000)")
.HasMaxLength(50000);
b.Property<string>("DeviceCode")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("UserCode");
@ -61,32 +64,32 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(50000)")
.HasMaxLength(50000);
b.Property<DateTime?>("Expiration")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("SubjectId")
.HasColumnType("TEXT")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnType("character varying(50)")
.HasMaxLength(50);
b.HasKey("Key");
@ -101,59 +104,59 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Kyoo.Models.User", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Email")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("OTAC")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<DateTime?>("OTACExpires")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.HasKey("Id");
@ -171,18 +174,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasColumnType("TEXT")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.HasKey("Id");
@ -198,17 +201,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("Id");
@ -221,17 +225,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("Id");
@ -243,19 +248,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("ProviderKey")
.HasColumnType("TEXT")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
@ -267,10 +272,10 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
@ -282,18 +287,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("Name")
.HasColumnType("TEXT")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("Value")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");

View File

@ -5,47 +5,46 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal
{
[DbContext(typeof(DatabaseContext))]
[Migration("20200507185533_Initial")]
[Migration("20200526235513_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.3");
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Kyoo.Models.Collection", b =>
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ImgPrimary")
.HasColumnType("TEXT");
b.Property<long?>("LibraryID")
.HasColumnType("INTEGER");
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("LibraryID");
b.HasIndex("Slug")
.IsUnique();
@ -56,13 +55,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CollectionID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -77,40 +77,41 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long>("AbsoluteNumber")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("EpisodeNumber")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("ImgPrimary")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<DateTime?>("ReleaseDate")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<long>("Runtime")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long?>("SeasonID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("SeasonNumber")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -125,13 +126,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -144,10 +146,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
{
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("GenreID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ShowID", "GenreID");
@ -160,16 +162,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Paths")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -183,16 +186,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CollectionID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("LibraryID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long?>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -209,28 +213,29 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("DataID")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("EpisodeID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Link")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("PeopleID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ProviderID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long?>("SeasonID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long?>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -251,16 +256,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ImgPrimary")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -274,19 +280,20 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long>("PeopleID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Role")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Type")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -301,13 +308,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Logo")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -321,13 +329,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("LibraryID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ProviderID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -342,25 +351,26 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ImgPrimary")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long>("SeasonNumber")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("Year")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -373,57 +383,53 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Aliases")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Backdrop")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("EndYear")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<bool>("IsMovie")
.HasColumnType("INTEGER");
b.Property<long?>("LibraryID")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("Logo")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("StartYear")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<int?>("Status")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<long?>("StudioID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("TrailerUrl")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("LibraryID");
b.HasIndex("Slug")
.IsUnique();
@ -436,13 +442,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -456,34 +463,35 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Codec")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long>("EpisodeID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<bool>("IsDefault")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("IsExternal")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("IsForced")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("Language")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<int>("Type")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.HasKey("ID");
@ -492,13 +500,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.ToTable("Tracks");
});
modelBuilder.Entity("Kyoo.Models.Collection", b =>
{
b.HasOne("Kyoo.Models.Library", null)
.WithMany("Collections")
.HasForeignKey("LibraryID");
});
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
{
b.HasOne("Kyoo.Models.Collection", "Collection")
@ -547,7 +548,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("CollectionID");
b.HasOne("Kyoo.Models.Library", "Library")
.WithMany()
.WithMany("Links")
.HasForeignKey("LibraryID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@ -600,7 +601,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
{
b.HasOne("Kyoo.Models.Library", "Library")
.WithMany("Providers")
.WithMany("ProviderLinks")
.HasForeignKey("LibraryID");
b.HasOne("Kyoo.Models.ProviderID", "Provider")
@ -621,12 +622,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
modelBuilder.Entity("Kyoo.Models.Show", b =>
{
b.HasOne("Kyoo.Models.Library", null)
.WithMany("Shows")
.HasForeignKey("LibraryID");
b.HasOne("Kyoo.Models.Studio", "Studio")
.WithMany()
.WithMany("Shows")
.HasForeignKey("StudioID");
});

View File

@ -1,5 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal
{
@ -7,12 +8,29 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Collections",
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
Poster = table.Column<string>(nullable: true),
Overview = table.Column<string>(nullable: true),
ImgPrimary = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Collections", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Genres",
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true)
},
@ -26,7 +44,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
Paths = table.Column<string>(nullable: true)
@ -41,7 +59,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
ImgPrimary = table.Column<string>(nullable: true)
@ -56,7 +74,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(nullable: true),
Logo = table.Column<string>(nullable: true)
},
@ -70,7 +88,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true)
},
@ -79,36 +97,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
table.PrimaryKey("PK_Studios", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Collections",
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Slug = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: true),
Poster = table.Column<string>(nullable: true),
Overview = table.Column<string>(nullable: true),
ImgPrimary = table.Column<string>(nullable: true),
LibraryID = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Collections", x => x.ID);
table.ForeignKey(
name: "FK_Collections_Libraries_LibraryID",
column: x => x.LibraryID,
principalTable: "Libraries",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ProviderLinks",
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProviderID = table.Column<long>(nullable: false),
LibraryID = table.Column<long>(nullable: true)
},
@ -134,7 +128,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(nullable: true),
Title = table.Column<string>(nullable: true),
Aliases = table.Column<string>(nullable: true),
@ -148,18 +142,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
Logo = table.Column<string>(nullable: true),
Backdrop = table.Column<string>(nullable: true),
IsMovie = table.Column<bool>(nullable: false),
StudioID = table.Column<long>(nullable: true),
LibraryID = table.Column<long>(nullable: true)
StudioID = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Shows", x => x.ID);
table.ForeignKey(
name: "FK_Shows_Libraries_LibraryID",
column: x => x.LibraryID,
principalTable: "Libraries",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Shows_Studios_StudioID",
column: x => x.StudioID,
@ -173,7 +160,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CollectionID = table.Column<long>(nullable: true),
ShowID = table.Column<long>(nullable: false)
},
@ -223,7 +210,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
LibraryID = table.Column<long>(nullable: false),
ShowID = table.Column<long>(nullable: true),
CollectionID = table.Column<long>(nullable: true)
@ -256,7 +243,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PeopleID = table.Column<long>(nullable: false),
ShowID = table.Column<long>(nullable: false),
Role = table.Column<string>(nullable: true),
@ -284,7 +271,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ShowID = table.Column<long>(nullable: false),
SeasonNumber = table.Column<long>(nullable: false),
Title = table.Column<string>(nullable: true),
@ -308,7 +295,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ShowID = table.Column<long>(nullable: false),
SeasonID = table.Column<long>(nullable: true),
SeasonNumber = table.Column<long>(nullable: false),
@ -343,7 +330,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProviderID = table.Column<long>(nullable: false),
ShowID = table.Column<long>(nullable: true),
EpisodeID = table.Column<long>(nullable: true),
@ -392,7 +379,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
columns: table => new
{
ID = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Title = table.Column<string>(nullable: true),
Language = table.Column<string>(nullable: true),
Codec = table.Column<string>(nullable: true),
@ -424,11 +411,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
table: "CollectionLinks",
column: "ShowID");
migrationBuilder.CreateIndex(
name: "IX_Collections_LibraryID",
table: "Collections",
column: "LibraryID");
migrationBuilder.CreateIndex(
name: "IX_Collections_Slug",
table: "Collections",
@ -539,11 +521,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
table: "Seasons",
column: "ShowID");
migrationBuilder.CreateIndex(
name: "IX_Shows_LibraryID",
table: "Shows",
column: "LibraryID");
migrationBuilder.CreateIndex(
name: "IX_Shows_Slug",
table: "Shows",
@ -599,6 +576,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
migrationBuilder.DropTable(
name: "Peoples");
migrationBuilder.DropTable(
name: "Libraries");
migrationBuilder.DropTable(
name: "Providers");
@ -611,9 +591,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
migrationBuilder.DropTable(
name: "Shows");
migrationBuilder.DropTable(
name: "Libraries");
migrationBuilder.DropTable(
name: "Studios");
}

View File

@ -4,6 +4,7 @@ using Kyoo;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal
{
@ -14,36 +15,34 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.3");
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Kyoo.Models.Collection", b =>
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ImgPrimary")
.HasColumnType("TEXT");
b.Property<long?>("LibraryID")
.HasColumnType("INTEGER");
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("LibraryID");
b.HasIndex("Slug")
.IsUnique();
@ -54,13 +53,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CollectionID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -75,40 +75,41 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long>("AbsoluteNumber")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("EpisodeNumber")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("ImgPrimary")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<DateTime?>("ReleaseDate")
.HasColumnType("TEXT");
.HasColumnType("timestamp without time zone");
b.Property<long>("Runtime")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long?>("SeasonID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("SeasonNumber")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -123,13 +124,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -142,10 +144,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
{
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("GenreID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ShowID", "GenreID");
@ -158,16 +160,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Paths")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -181,16 +184,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("CollectionID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("LibraryID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long?>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -207,28 +211,29 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("DataID")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("EpisodeID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Link")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("PeopleID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ProviderID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long?>("SeasonID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long?>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -249,16 +254,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ImgPrimary")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -272,19 +278,20 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long>("PeopleID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Role")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Type")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -299,13 +306,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Logo")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -319,13 +327,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<long?>("LibraryID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ProviderID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -340,25 +349,26 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ImgPrimary")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long>("SeasonNumber")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<long>("ShowID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("Year")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.HasKey("ID");
@ -371,57 +381,53 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Aliases")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Backdrop")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("EndYear")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<bool>("IsMovie")
.HasColumnType("INTEGER");
b.Property<long?>("LibraryID")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("Logo")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long?>("StartYear")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<int?>("Status")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.Property<long?>("StudioID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("TrailerUrl")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("LibraryID");
b.HasIndex("Slug")
.IsUnique();
@ -434,13 +440,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Slug")
.HasColumnType("TEXT");
.HasColumnType("text");
b.HasKey("ID");
@ -454,34 +461,35 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
{
b.Property<long>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Codec")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<long>("EpisodeID")
.HasColumnType("INTEGER");
.HasColumnType("bigint");
b.Property<bool>("IsDefault")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("IsExternal")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<bool>("IsForced")
.HasColumnType("INTEGER");
.HasColumnType("boolean");
b.Property<string>("Language")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<string>("Title")
.HasColumnType("TEXT");
.HasColumnType("text");
b.Property<int>("Type")
.HasColumnType("INTEGER");
.HasColumnType("integer");
b.HasKey("ID");
@ -490,13 +498,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
b.ToTable("Tracks");
});
modelBuilder.Entity("Kyoo.Models.Collection", b =>
{
b.HasOne("Kyoo.Models.Library", null)
.WithMany("Collections")
.HasForeignKey("LibraryID");
});
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
{
b.HasOne("Kyoo.Models.Collection", "Collection")
@ -545,7 +546,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
.HasForeignKey("CollectionID");
b.HasOne("Kyoo.Models.Library", "Library")
.WithMany()
.WithMany("Links")
.HasForeignKey("LibraryID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@ -598,7 +599,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
{
b.HasOne("Kyoo.Models.Library", "Library")
.WithMany("Providers")
.WithMany("ProviderLinks")
.HasForeignKey("LibraryID");
b.HasOne("Kyoo.Models.ProviderID", "Provider")
@ -619,12 +620,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
modelBuilder.Entity("Kyoo.Models.Show", b =>
{
b.HasOne("Kyoo.Models.Library", null)
.WithMany("Shows")
.HasForeignKey("LibraryID");
b.HasOne("Kyoo.Models.Studio", "Studio")
.WithMany()
.WithMany("Shows")
.HasForeignKey("StudioID");
});

View File

@ -14,7 +14,6 @@ using Microsoft.AspNetCore.SpaServices.AngularCli;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
@ -44,22 +43,22 @@ namespace Kyoo
services.AddControllers().AddNewtonsoftJson();
services.AddHttpClient();
services.AddSingleton<DatabaseFactory>(x => new DatabaseFactory(
services.AddSingleton(x => new DatabaseFactory(
new DbContextOptionsBuilder<DatabaseContext>()
.UseLazyLoadingProxies()
.UseSqlite(_configuration.GetConnectionString("Database")).Options));
.UseNpgsql(_configuration.GetConnectionString("Database")).Options));
services.AddDbContext<DatabaseContext>(options =>
{
options.UseLazyLoadingProxies()
.UseSqlite(_configuration.GetConnectionString("Database"));
.UseNpgsql(_configuration.GetConnectionString("Database"));
// .EnableSensitiveDataLogging()
// .UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
});
services.AddDbContext<IdentityDatabase>(options =>
{
options.UseSqlite(_configuration.GetConnectionString("Database"));
options.UseNpgsql(_configuration.GetConnectionString("Database"));
});
string assemblyName = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
@ -85,13 +84,13 @@ namespace Kyoo
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder =>
builder.UseSqlite(_configuration.GetConnectionString("Database"),
builder.UseNpgsql(_configuration.GetConnectionString("Database"),
sql => sql.MigrationsAssembly(assemblyName));
})
.AddOperationalStore(options =>
{
options.ConfigureDbContext = builder =>
builder.UseSqlite(_configuration.GetConnectionString("Database"),
builder.UseNpgsql(_configuration.GetConnectionString("Database"),
sql => sql.MigrationsAssembly(assemblyName));
options.EnableTokenCleanup = true;
})
@ -145,7 +144,7 @@ namespace Kyoo
services.AddSingleton<IPluginManager, PluginManager>();
services.AddSingleton<ITaskManager, TaskManager>();
services.AddHostedService<TaskManager>(provider => (TaskManager)provider.GetService<ITaskManager>());
services.AddHostedService(provider => (TaskManager)provider.GetService<ITaskManager>());
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@ -65,9 +65,7 @@ namespace Kyoo.Controllers
}
await libraryManager.SaveChanges();
// await Task.WhenAll(libraries.Select(x => Scan(x, libraryManager, cancellationToken)));
foreach (Library library in libraries)
await Scan(library, libraryManager, cancellationToken);
await Task.WhenAll(libraries.ToList().Select(x => Scan(x, libraryManager, cancellationToken)));
}
catch (Exception ex)
{
@ -76,11 +74,10 @@ namespace Kyoo.Controllers
Console.WriteLine("Scan finished!");
}
private async Task<Task> Scan(Library library, ILibraryManager libraryManager, CancellationToken cancellationToken)
private Task Scan(Library library, ILibraryManager libraryManager, CancellationToken cancellationToken)
{
Console.WriteLine($"Scanning library {library.Name} at {string.Join(", ", library.Paths)}.");
// return Task.WhenAll(library.Paths.Select(path =>
foreach (string path in library.Paths)
return Task.WhenAll(library.Paths.Select(async path =>
{
if (cancellationToken.IsCancellationRequested)
return Task.CompletedTask;
@ -119,8 +116,9 @@ namespace Kyoo.Controllers
string relativePath = file.Substring(path.Length);
/*return*/ await RegisterFile(file, relativePath, library, cancellationToken);
}//));
}//));
return Task.CompletedTask;
return Task.CompletedTask;
}));
}
private async Task RegisterFile(string path, string relativePath, Library library, CancellationToken token)

View File

@ -19,7 +19,7 @@ namespace Kyoo.Tasks
public string Description => "Create the database if it does not exit and initialize it with defaults value.";
public string HelpMessage => null;
public bool RunOnStartup => true;
public int Priority => Int32.MaxValue;
public int Priority => int.MaxValue;
public Task Run(IServiceProvider serviceProvider, CancellationToken cancellationToken, string arguments = null)
{
@ -27,7 +27,12 @@ namespace Kyoo.Tasks
DatabaseContext databaseContext = serviceScope.ServiceProvider.GetService<DatabaseContext>();
IdentityDatabase identityDatabase = serviceScope.ServiceProvider.GetService<IdentityDatabase>();
ConfigurationDbContext identityContext = serviceScope.ServiceProvider.GetService<ConfigurationDbContext>();
if (!databaseContext.Database.CanConnect()
|| !identityDatabase.Database.CanConnect()
|| !identityContext.Database.CanConnect())
throw new SystemException("Coudln't connect to the database.");
databaseContext.Database.Migrate();
identityDatabase.Database.Migrate();
identityContext.Database.Migrate();

View File

@ -12,7 +12,7 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Database": "Data Source=kyoo.db"
"Database": "Server=127.0.0.1; Port=5432; Database=kyooDB; User Id=kyoo; Password=kyooPassword;"
},
"scheduledTasks": {