From 28d48e9daf455e0b6aa71498e749e77f10e2e984 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 30 May 2020 18:08:42 +0200 Subject: [PATCH] Replacing sqlite with postgres --- Kyoo/Kyoo.csproj | 2 +- ....cs => 20200526235342_Initial.Designer.cs} | 282 ++++++++++-------- ...7_Initial.cs => 20200526235342_Initial.cs} | 41 +-- .../ConfigurationDbContextModelSnapshot.cs | 280 +++++++++-------- ....cs => 20200526235424_Initial.Designer.cs} | 115 +++---- ...5_Initial.cs => 20200526235424_Initial.cs} | 5 +- .../IdentityDatabaseModelSnapshot.cs | 113 +++---- ....cs => 20200526235513_Initial.Designer.cs} | 233 +++++++-------- ...3_Initial.cs => 20200526235513_Initial.cs} | 95 +++--- .../Internal/DatabaseContextModelSnapshot.cs | 231 +++++++------- Kyoo/Startup.cs | 15 +- Kyoo/Tasks/Crawler.cs | 14 +- Kyoo/Tasks/CreateDatabase.cs | 9 +- Kyoo/appsettings.json | 2 +- 14 files changed, 733 insertions(+), 704 deletions(-) rename Kyoo/Models/DatabaseMigrations/IdentityConfiguration/{20200413152957_Initial.Designer.cs => 20200526235342_Initial.Designer.cs} (69%) rename Kyoo/Models/DatabaseMigrations/IdentityConfiguration/{20200413152957_Initial.cs => 20200526235342_Initial.cs} (91%) rename Kyoo/Models/DatabaseMigrations/IdentityDatbase/{20200413153045_Initial.Designer.cs => 20200526235424_Initial.Designer.cs} (72%) rename Kyoo/Models/DatabaseMigrations/IdentityDatbase/{20200413153045_Initial.cs => 20200526235424_Initial.cs} (97%) rename Kyoo/Models/DatabaseMigrations/Internal/{20200507185533_Initial.Designer.cs => 20200526235513_Initial.Designer.cs} (69%) rename Kyoo/Models/DatabaseMigrations/Internal/{20200507185533_Initial.cs => 20200526235513_Initial.cs} (91%) diff --git a/Kyoo/Kyoo.csproj b/Kyoo/Kyoo.csproj index fcc1332c..69d8d8df 100644 --- a/Kyoo/Kyoo.csproj +++ b/Kyoo/Kyoo.csproj @@ -25,6 +25,7 @@ + @@ -42,7 +43,6 @@ - diff --git a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200413152957_Initial.Designer.cs b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.Designer.cs similarity index 69% rename from Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200413152957_Initial.Designer.cs rename to Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.Designer.cs index 9db66b75..02ebc8c3 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200413152957_Initial.Designer.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.Designer.cs @@ -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("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("DisplayName") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Enabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("LastAccessed") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("NonEditable") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Updated") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.HasKey("Id"); @@ -64,14 +68,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -85,19 +90,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Key") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); @@ -111,32 +117,33 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("DisplayName") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Emphasize") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Required") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("ShowInDiscoveryDocument") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.HasKey("Id"); @@ -152,14 +159,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiScopeId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -173,29 +181,30 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("Expiration") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(4000)") .HasMaxLength(4000); b.HasKey("Id"); @@ -209,143 +218,144 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("AbsoluteRefreshTokenLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("AccessTokenLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("AccessTokenType") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("AllowAccessTokensViaBrowser") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AllowOfflineAccess") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AllowPlainTextPkce") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AllowRememberConsent") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AlwaysIncludeUserClaimsInIdToken") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AlwaysSendClientClaims") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AuthorizationCodeLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("BackChannelLogoutSessionRequired") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("BackChannelLogoutUri") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("ClientClaimsPrefix") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientName") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("ConsentLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("DeviceCodeLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("EnableLocalLogin") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Enabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("FrontChannelLogoutSessionRequired") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("FrontChannelLogoutUri") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("IdentityTokenLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("IncludeJwtId") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("LastAccessed") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("LogoUri") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("NonEditable") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("PairWiseSubjectSalt") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("RefreshTokenExpiration") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("RefreshTokenUsage") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("RequireClientSecret") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("RequireConsent") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("RequirePkce") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("SlidingRefreshTokenLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("UpdateAccessTokenClaimsOnRefresh") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Updated") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("UserCodeType") - .HasColumnType("TEXT") + .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property("UserSsoLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.HasKey("Id"); @@ -359,19 +369,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.HasKey("Id"); @@ -385,14 +396,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Origin") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(150)") .HasMaxLength(150); b.HasKey("Id"); @@ -406,14 +418,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("GrantType") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.HasKey("Id"); @@ -427,14 +440,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Provider") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -448,14 +462,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("PostLogoutRedirectUri") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); @@ -469,19 +484,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Key") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); @@ -495,14 +511,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("RedirectUri") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); @@ -516,14 +533,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Scope") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -537,29 +555,30 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("Expiration") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(4000)") .HasMaxLength(4000); b.HasKey("Id"); @@ -573,14 +592,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("IdentityResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -594,41 +614,42 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("DisplayName") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Emphasize") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Enabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("NonEditable") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Required") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("ShowInDiscoveryDocument") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Updated") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.HasKey("Id"); @@ -642,19 +663,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("IdentityResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Key") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); diff --git a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200413152957_Initial.cs b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.cs similarity index 91% rename from Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200413152957_Initial.cs rename to Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.cs index 431b2fd9..447f9385 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200413152957_Initial.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/20200526235342_Initial.cs @@ -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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Enabled = table.Column(nullable: false), Name = table.Column(maxLength: 200, nullable: false), DisplayName = table.Column(maxLength: 200, nullable: true), @@ -32,7 +33,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Enabled = table.Column(nullable: false), ClientId = table.Column(maxLength: 200, nullable: false), ProtocolType = table.Column(maxLength: 200, nullable: false), @@ -85,7 +86,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Enabled = table.Column(nullable: false), Name = table.Column(maxLength: 200, nullable: false), DisplayName = table.Column(maxLength: 200, nullable: true), @@ -107,7 +108,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false) }, @@ -127,7 +128,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Key = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 2000, nullable: false), ApiResourceId = table.Column(nullable: false) @@ -148,7 +149,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(maxLength: 200, nullable: false), DisplayName = table.Column(maxLength: 200, nullable: true), Description = table.Column(maxLength: 1000, nullable: true), @@ -173,7 +174,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Description = table.Column(maxLength: 1000, nullable: true), Value = table.Column(maxLength: 4000, nullable: false), Expiration = table.Column(nullable: true), @@ -197,7 +198,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Type = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 250, nullable: false), ClientId = table.Column(nullable: false) @@ -218,7 +219,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Origin = table.Column(maxLength: 150, nullable: false), ClientId = table.Column(nullable: false) }, @@ -238,7 +239,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), GrantType = table.Column(maxLength: 250, nullable: false), ClientId = table.Column(nullable: false) }, @@ -258,7 +259,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Provider = table.Column(maxLength: 200, nullable: false), ClientId = table.Column(nullable: false) }, @@ -278,7 +279,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false), ClientId = table.Column(nullable: false) }, @@ -298,7 +299,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Key = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 2000, nullable: false), ClientId = table.Column(nullable: false) @@ -319,7 +320,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), RedirectUri = table.Column(maxLength: 2000, nullable: false), ClientId = table.Column(nullable: false) }, @@ -339,7 +340,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Scope = table.Column(maxLength: 200, nullable: false), ClientId = table.Column(nullable: false) }, @@ -359,7 +360,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Description = table.Column(maxLength: 2000, nullable: true), Value = table.Column(maxLength: 4000, nullable: false), Expiration = table.Column(nullable: true), @@ -383,7 +384,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Type = table.Column(maxLength: 200, nullable: false), IdentityResourceId = table.Column(nullable: false) }, @@ -403,7 +404,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Key = table.Column(maxLength: 250, nullable: false), Value = table.Column(maxLength: 2000, nullable: false), IdentityResourceId = table.Column(nullable: false) @@ -424,7 +425,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Type = table.Column(maxLength: 200, nullable: false), ApiScopeId = table.Column(nullable: false) }, diff --git a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/ConfigurationDbContextModelSnapshot.cs b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/ConfigurationDbContextModelSnapshot.cs index 6e988a02..f83d80e5 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/ConfigurationDbContextModelSnapshot.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityConfiguration/ConfigurationDbContextModelSnapshot.cs @@ -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("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("DisplayName") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Enabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("LastAccessed") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("NonEditable") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Updated") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.HasKey("Id"); @@ -62,14 +66,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -83,19 +88,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Key") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); @@ -109,32 +115,33 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("DisplayName") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Emphasize") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Required") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("ShowInDiscoveryDocument") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.HasKey("Id"); @@ -150,14 +157,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiScopeId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -171,29 +179,30 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ApiResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("Expiration") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(4000)") .HasMaxLength(4000); b.HasKey("Id"); @@ -207,143 +216,144 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("AbsoluteRefreshTokenLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("AccessTokenLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("AccessTokenType") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("AllowAccessTokensViaBrowser") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AllowOfflineAccess") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AllowPlainTextPkce") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AllowRememberConsent") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AlwaysIncludeUserClaimsInIdToken") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AlwaysSendClientClaims") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("AuthorizationCodeLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("BackChannelLogoutSessionRequired") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("BackChannelLogoutUri") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("ClientClaimsPrefix") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientName") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("ConsentLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("DeviceCodeLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("EnableLocalLogin") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Enabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("FrontChannelLogoutSessionRequired") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("FrontChannelLogoutUri") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("IdentityTokenLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("IncludeJwtId") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("LastAccessed") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("LogoUri") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("NonEditable") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("PairWiseSubjectSalt") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("RefreshTokenExpiration") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("RefreshTokenUsage") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("RequireClientSecret") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("RequireConsent") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("RequirePkce") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("SlidingRefreshTokenLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("UpdateAccessTokenClaimsOnRefresh") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Updated") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("UserCodeType") - .HasColumnType("TEXT") + .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property("UserSsoLifetime") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.HasKey("Id"); @@ -357,19 +367,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.HasKey("Id"); @@ -383,14 +394,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Origin") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(150)") .HasMaxLength(150); b.HasKey("Id"); @@ -404,14 +416,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("GrantType") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.HasKey("Id"); @@ -425,14 +438,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Provider") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -446,14 +460,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("PostLogoutRedirectUri") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); @@ -467,19 +482,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Key") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); @@ -493,14 +509,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("RedirectUri") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); @@ -514,14 +531,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Scope") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -535,29 +553,30 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClientId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.Property("Expiration") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(4000)") .HasMaxLength(4000); b.HasKey("Id"); @@ -571,14 +590,15 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("IdentityResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Type") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.HasKey("Id"); @@ -592,41 +612,42 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Created") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Description") - .HasColumnType("TEXT") + .HasColumnType("character varying(1000)") .HasMaxLength(1000); b.Property("DisplayName") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Emphasize") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Enabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Name") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("NonEditable") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Required") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("ShowInDiscoveryDocument") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Updated") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.HasKey("Id"); @@ -640,19 +661,20 @@ namespace Kyoo.Models.DatabaseMigrations.IdentitiyConfiguration { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("IdentityResourceId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("Key") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(250)") .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(2000)") .HasMaxLength(2000); b.HasKey("Id"); diff --git a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200413153045_Initial.Designer.cs b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.Designer.cs similarity index 72% rename from Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200413153045_Initial.Designer.cs rename to Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.Designer.cs index 15958d3a..ced0460b 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200413153045_Initial.Designer.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.Designer.cs @@ -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("UserCode") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("CreationTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Data") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(50000)") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Expiration") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("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("Key") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("CreationTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Data") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(50000)") .HasMaxLength(50000); b.Property("Expiration") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("SubjectId") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("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("Id") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Email") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("LockoutEnd") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property("NormalizedEmail") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.Property("NormalizedUserName") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.Property("OTAC") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("OTACExpires") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("PasswordHash") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PhoneNumber") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("SecurityStamp") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("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("Id") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Name") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.Property("NormalizedName") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -200,17 +203,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("RoleId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("Id"); @@ -223,17 +227,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("UserId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("Id"); @@ -245,19 +250,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("TEXT") + .HasColumnType("character varying(128)") .HasMaxLength(128); b.Property("ProviderKey") - .HasColumnType("TEXT") + .HasColumnType("character varying(128)") .HasMaxLength(128); b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("RoleId") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("UserId", "RoleId"); @@ -284,18 +289,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("LoginProvider") - .HasColumnType("TEXT") + .HasColumnType("character varying(128)") .HasMaxLength(128); b.Property("Name") - .HasColumnType("TEXT") + .HasColumnType("character varying(128)") .HasMaxLength(128); b.Property("Value") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200413153045_Initial.cs b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.cs similarity index 97% rename from Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200413153045_Initial.cs rename to Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.cs index 2c3bacf1..15abc8d3 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200413153045_Initial.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/20200526235424_Initial.cs @@ -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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), UserId = table.Column(nullable: false), ClaimType = table.Column(nullable: true), ClaimValue = table.Column(nullable: true) @@ -172,7 +173,7 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase columns: table => new { Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), RoleId = table.Column(nullable: false), ClaimType = table.Column(nullable: true), ClaimValue = table.Column(nullable: true) diff --git a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/IdentityDatabaseModelSnapshot.cs b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/IdentityDatabaseModelSnapshot.cs index d7eeed8a..995c15db 100644 --- a/Kyoo/Models/DatabaseMigrations/IdentityDatbase/IdentityDatabaseModelSnapshot.cs +++ b/Kyoo/Models/DatabaseMigrations/IdentityDatbase/IdentityDatabaseModelSnapshot.cs @@ -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("UserCode") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("CreationTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Data") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(50000)") .HasMaxLength(50000); b.Property("DeviceCode") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("Expiration") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("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("Key") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("CreationTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Data") .IsRequired() - .HasColumnType("TEXT") + .HasColumnType("character varying(50000)") .HasMaxLength(50000); b.Property("Expiration") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("SubjectId") - .HasColumnType("TEXT") + .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property("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("Id") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("AccessFailedCount") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Email") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.Property("EmailConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("LockoutEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("LockoutEnd") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property("NormalizedEmail") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.Property("NormalizedUserName") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.Property("OTAC") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("OTACExpires") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("PasswordHash") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PhoneNumber") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PhoneNumberConfirmed") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("SecurityStamp") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("TwoFactorEnabled") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("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("Id") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Name") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.Property("NormalizedName") - .HasColumnType("TEXT") + .HasColumnType("character varying(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -198,17 +201,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("RoleId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("Id"); @@ -221,17 +225,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase { b.Property("Id") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ClaimType") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ClaimValue") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("UserId") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("Id"); @@ -243,19 +248,19 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { b.Property("LoginProvider") - .HasColumnType("TEXT") + .HasColumnType("character varying(128)") .HasMaxLength(128); b.Property("ProviderKey") - .HasColumnType("TEXT") + .HasColumnType("character varying(128)") .HasMaxLength(128); b.Property("ProviderDisplayName") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("RoleId") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("UserId", "RoleId"); @@ -282,18 +287,18 @@ namespace Kyoo.Models.DatabaseMigrations.IdentityDatbase modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { b.Property("UserId") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("LoginProvider") - .HasColumnType("TEXT") + .HasColumnType("character varying(128)") .HasMaxLength(128); b.Property("Name") - .HasColumnType("TEXT") + .HasColumnType("character varying(128)") .HasMaxLength(128); b.Property("Value") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("UserId", "LoginProvider", "Name"); diff --git a/Kyoo/Models/DatabaseMigrations/Internal/20200507185533_Initial.Designer.cs b/Kyoo/Models/DatabaseMigrations/Internal/20200526235513_Initial.Designer.cs similarity index 69% rename from Kyoo/Models/DatabaseMigrations/Internal/20200507185533_Initial.Designer.cs rename to Kyoo/Models/DatabaseMigrations/Internal/20200526235513_Initial.Designer.cs index c9475964..559076f9 100644 --- a/Kyoo/Models/DatabaseMigrations/Internal/20200507185533_Initial.Designer.cs +++ b/Kyoo/Models/DatabaseMigrations/Internal/20200526235513_Initial.Designer.cs @@ -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("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ImgPrimary") - .HasColumnType("TEXT"); - - b.Property("LibraryID") - .HasColumnType("INTEGER"); + .HasColumnType("text"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Overview") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Poster") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("CollectionID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -77,40 +77,41 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("AbsoluteNumber") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("EpisodeNumber") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ImgPrimary") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Overview") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Path") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ReleaseDate") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Runtime") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("SeasonID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("SeasonNumber") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Title") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -125,13 +126,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("GenreID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ShowID", "GenreID"); @@ -160,16 +162,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Paths") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Slug") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -183,16 +186,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("CollectionID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("LibraryID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -209,28 +213,29 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("DataID") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("EpisodeID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Link") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PeopleID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ProviderID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("SeasonID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -251,16 +256,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ImgPrimary") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Slug") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -274,19 +280,20 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("PeopleID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Role") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Type") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -301,13 +308,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Logo") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -321,13 +329,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("LibraryID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ProviderID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -342,25 +351,26 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ImgPrimary") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Overview") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("SeasonNumber") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Title") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Year") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -373,57 +383,53 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Aliases") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Backdrop") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("EndYear") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("IsMovie") - .HasColumnType("INTEGER"); - - b.Property("LibraryID") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Logo") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Overview") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Path") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Poster") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Slug") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("StartYear") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Status") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("StudioID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Title") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Slug") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -456,34 +463,35 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Codec") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("EpisodeID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("IsDefault") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("IsExternal") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("IsForced") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Language") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Path") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Title") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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"); }); diff --git a/Kyoo/Models/DatabaseMigrations/Internal/20200507185533_Initial.cs b/Kyoo/Models/DatabaseMigrations/Internal/20200526235513_Initial.cs similarity index 91% rename from Kyoo/Models/DatabaseMigrations/Internal/20200507185533_Initial.cs rename to Kyoo/Models/DatabaseMigrations/Internal/20200526235513_Initial.cs index bea865a2..d3b90b3a 100644 --- a/Kyoo/Models/DatabaseMigrations/Internal/20200507185533_Initial.cs +++ b/Kyoo/Models/DatabaseMigrations/Internal/20200526235513_Initial.cs @@ -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(nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Slug = table.Column(nullable: true), + Name = table.Column(nullable: true), + Poster = table.Column(nullable: true), + Overview = table.Column(nullable: true), + ImgPrimary = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Collections", x => x.ID); + }); + migrationBuilder.CreateTable( name: "Genres", columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Slug = table.Column(nullable: true), Name = table.Column(nullable: true) }, @@ -26,7 +44,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Slug = table.Column(nullable: true), Name = table.Column(nullable: true), Paths = table.Column(nullable: true) @@ -41,7 +59,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Slug = table.Column(nullable: true), Name = table.Column(nullable: true), ImgPrimary = table.Column(nullable: true) @@ -56,7 +74,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(nullable: true), Logo = table.Column(nullable: true) }, @@ -70,7 +88,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Slug = table.Column(nullable: true), Name = table.Column(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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Slug = table.Column(nullable: true), - Name = table.Column(nullable: true), - Poster = table.Column(nullable: true), - Overview = table.Column(nullable: true), - ImgPrimary = table.Column(nullable: true), - LibraryID = table.Column(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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ProviderID = table.Column(nullable: false), LibraryID = table.Column(nullable: true) }, @@ -134,7 +128,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Slug = table.Column(nullable: true), Title = table.Column(nullable: true), Aliases = table.Column(nullable: true), @@ -148,18 +142,11 @@ namespace Kyoo.Models.DatabaseMigrations.Internal Logo = table.Column(nullable: true), Backdrop = table.Column(nullable: true), IsMovie = table.Column(nullable: false), - StudioID = table.Column(nullable: true), - LibraryID = table.Column(nullable: true) + StudioID = table.Column(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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), CollectionID = table.Column(nullable: true), ShowID = table.Column(nullable: false) }, @@ -223,7 +210,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), LibraryID = table.Column(nullable: false), ShowID = table.Column(nullable: true), CollectionID = table.Column(nullable: true) @@ -256,7 +243,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), PeopleID = table.Column(nullable: false), ShowID = table.Column(nullable: false), Role = table.Column(nullable: true), @@ -284,7 +271,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ShowID = table.Column(nullable: false), SeasonNumber = table.Column(nullable: false), Title = table.Column(nullable: true), @@ -308,7 +295,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ShowID = table.Column(nullable: false), SeasonID = table.Column(nullable: true), SeasonNumber = table.Column(nullable: false), @@ -343,7 +330,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), ProviderID = table.Column(nullable: false), ShowID = table.Column(nullable: true), EpisodeID = table.Column(nullable: true), @@ -392,7 +379,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal columns: table => new { ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Title = table.Column(nullable: true), Language = table.Column(nullable: true), Codec = table.Column(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"); } diff --git a/Kyoo/Models/DatabaseMigrations/Internal/DatabaseContextModelSnapshot.cs b/Kyoo/Models/DatabaseMigrations/Internal/DatabaseContextModelSnapshot.cs index 2eddf479..be3dd87f 100644 --- a/Kyoo/Models/DatabaseMigrations/Internal/DatabaseContextModelSnapshot.cs +++ b/Kyoo/Models/DatabaseMigrations/Internal/DatabaseContextModelSnapshot.cs @@ -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("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ImgPrimary") - .HasColumnType("TEXT"); - - b.Property("LibraryID") - .HasColumnType("INTEGER"); + .HasColumnType("text"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Overview") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Poster") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("CollectionID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -75,40 +75,41 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("AbsoluteNumber") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("EpisodeNumber") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ImgPrimary") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Overview") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Path") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ReleaseDate") - .HasColumnType("TEXT"); + .HasColumnType("timestamp without time zone"); b.Property("Runtime") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("SeasonID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("SeasonNumber") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Title") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -123,13 +124,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("GenreID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ShowID", "GenreID"); @@ -158,16 +160,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Paths") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Slug") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -181,16 +184,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("CollectionID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("LibraryID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -207,28 +211,29 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("DataID") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("EpisodeID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Link") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("PeopleID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ProviderID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("SeasonID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -249,16 +254,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ImgPrimary") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Slug") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -272,19 +278,20 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("PeopleID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Role") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Type") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -299,13 +306,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Logo") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -319,13 +327,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("LibraryID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ProviderID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -340,25 +349,26 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("ImgPrimary") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Overview") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("SeasonNumber") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("ShowID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Title") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Year") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.HasKey("ID"); @@ -371,57 +381,53 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Aliases") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Backdrop") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("EndYear") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("IsMovie") - .HasColumnType("INTEGER"); - - b.Property("LibraryID") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Logo") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Overview") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Path") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Poster") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Slug") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("StartYear") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Status") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property("StudioID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("Title") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Name") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Slug") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.HasKey("ID"); @@ -454,34 +461,35 @@ namespace Kyoo.Models.DatabaseMigrations.Internal { b.Property("ID") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("bigint") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property("Codec") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("EpisodeID") - .HasColumnType("INTEGER"); + .HasColumnType("bigint"); b.Property("IsDefault") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("IsExternal") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("IsForced") - .HasColumnType("INTEGER"); + .HasColumnType("boolean"); b.Property("Language") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Path") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("Title") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property("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"); }); diff --git a/Kyoo/Startup.cs b/Kyoo/Startup.cs index 64998be1..22baaf05 100644 --- a/Kyoo/Startup.cs +++ b/Kyoo/Startup.cs @@ -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(x => new DatabaseFactory( + services.AddSingleton(x => new DatabaseFactory( new DbContextOptionsBuilder() .UseLazyLoadingProxies() - .UseSqlite(_configuration.GetConnectionString("Database")).Options)); + .UseNpgsql(_configuration.GetConnectionString("Database")).Options)); services.AddDbContext(options => { options.UseLazyLoadingProxies() - .UseSqlite(_configuration.GetConnectionString("Database")); + .UseNpgsql(_configuration.GetConnectionString("Database")); // .EnableSensitiveDataLogging() // .UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole())); }); services.AddDbContext(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(); services.AddSingleton(); - services.AddHostedService(provider => (TaskManager)provider.GetService()); + services.AddHostedService(provider => (TaskManager)provider.GetService()); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/Kyoo/Tasks/Crawler.cs b/Kyoo/Tasks/Crawler.cs index 8f6bea6e..065bc613 100644 --- a/Kyoo/Tasks/Crawler.cs +++ b/Kyoo/Tasks/Crawler.cs @@ -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 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) diff --git a/Kyoo/Tasks/CreateDatabase.cs b/Kyoo/Tasks/CreateDatabase.cs index 87c4760a..c5345ab4 100644 --- a/Kyoo/Tasks/CreateDatabase.cs +++ b/Kyoo/Tasks/CreateDatabase.cs @@ -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(); IdentityDatabase identityDatabase = serviceScope.ServiceProvider.GetService(); ConfigurationDbContext identityContext = serviceScope.ServiceProvider.GetService(); - + + 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(); diff --git a/Kyoo/appsettings.json b/Kyoo/appsettings.json index 0c5a5935..a3b4f927 100644 --- a/Kyoo/appsettings.json +++ b/Kyoo/appsettings.json @@ -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": {