Using links in the common objects

This commit is contained in:
Zoe Roux 2021-03-06 00:53:21 +01:00
parent b8fcc5b7cf
commit 76cdbc77a3
23 changed files with 191 additions and 4931 deletions

View File

@ -349,6 +349,10 @@ namespace Kyoo.Controllers
(People p, nameof(People.Roles)) => PeopleRepository
.GetFromPeople(obj.ID)
.Then(x => p.Roles = x),
(ProviderID p, nameof(ProviderID.Libraries)) => LibraryRepository
.GetAll(x => x.Providers.Any(y => y.ID == obj.ID))
.Then(x => p.Libraries = x),
_ => throw new ArgumentException($"Couldn't find a way to load {member} of {obj.Slug}.")
};

View File

@ -16,6 +16,8 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<LangVersion>default</LangVersion>
<DefineConstants>ENABLE_INTERNAL_LINKS</DefineConstants>
</PropertyGroup>
<ItemGroup>

View File

@ -0,0 +1,23 @@
using System;
using System.Linq.Expressions;
namespace Kyoo.Models
{
public class Link<T1, T2>
where T1 : class, IResource
where T2 : class, IResource
{
public static Expression<Func<Link<T1, T2>, object>> PrimaryKey
{
get
{
return x => new {LibraryID = x.FirstID, ProviderID = x.SecondID};
}
}
public int FirstID { get; set; }
public virtual T1 First { get; set; }
public int SecondID { get; set; }
public virtual T2 Second { get; set; }
}
}

View File

@ -13,6 +13,11 @@ namespace Kyoo.Models
[LoadableRelation] public virtual ICollection<Show> Shows { get; set; }
[LoadableRelation] public virtual ICollection<Library> Libraries { get; set; }
#if ENABLE_INTERNAL_LINKS
[SerializeIgnore] public virtual ICollection<Link<Collection, Show>> ShowLinks { get; set; }
[SerializeIgnore] public virtual ICollection<Link<Library, Collection>> LibraryLinks { get; set; }
#endif
public Collection() { }
public Collection(string slug, string name, string overview, string poster)

View File

@ -10,7 +10,12 @@ namespace Kyoo.Models
public string Name { get; set; }
[LoadableRelation] public virtual ICollection<Show> Shows { get; set; }
#if ENABLE_INTERNAL_LINKS
[SerializeIgnore] public virtual ICollection<Link<Show, Genre>> ShowLinks { get; set; }
#endif
public Genre() {}
public Genre(string name)

View File

@ -9,16 +9,6 @@ namespace Kyoo.Models
public string Slug { get; }
}
public interface IResourceLink<out T, out T2>
where T : IResource
where T2 : IResource
{
public T Parent { get; }
public int ParentID { get; }
public T2 Child { get; }
public int ChildID { get; }
}
public class ResourceComparer<T> : IEqualityComparer<T> where T : IResource
{
public bool Equals(T x, T y)
@ -37,27 +27,4 @@ namespace Kyoo.Models
return HashCode.Combine(obj.ID, obj.Slug);
}
}
public class LinkComparer<T, T1, T2> : IEqualityComparer<T>
where T : IResourceLink<T1, T2>
where T1 : IResource
where T2 : IResource
{
public bool Equals(T x, T y)
{
if (ReferenceEquals(x, y))
return true;
if (ReferenceEquals(x, null))
return false;
if (ReferenceEquals(y, null))
return false;
return Utility.LinkEquals(x.Parent, x.ParentID, y.Parent, y.ParentID)
&& Utility.LinkEquals(x.Child, x.ChildID, y.Child, y.ChildID);
}
public int GetHashCode(T obj)
{
return HashCode.Combine(obj.Parent, obj.ParentID, obj.Child, obj.ChildID);
}
}
}

View File

@ -16,6 +16,12 @@ namespace Kyoo.Models
[LoadableRelation] public virtual ICollection<Show> Shows { get; set; }
[LoadableRelation] public virtual ICollection<Collection> Collections { get; set; }
#if ENABLE_INTERNAL_LINKS
[SerializeIgnore] public virtual ICollection<Link<Library, ProviderID>> ProviderLinks { get; set; }
[SerializeIgnore] public virtual ICollection<Link<Library, Show>> ShowLinks { get; set; }
[SerializeIgnore] public virtual ICollection<Link<Library, Collection>> CollectionLinks { get; set; }
#endif
public Library() { }
public Library(string slug, string name, IEnumerable<string> paths, IEnumerable<ProviderID> providers)

View File

@ -10,8 +10,12 @@ namespace Kyoo.Models
public string Name { get; set; }
public string Logo { get; set; }
[LoadableRelation] public ICollection<Library> Libraries { get; set; }
[LoadableRelation] public virtual ICollection<Library> Libraries { get; set; }
#if ENABLE_INTERNAL_LINKS
[SerializeIgnore] public virtual ICollection<Link<Library, ProviderID>> LibraryLinks { get; set; }
#endif
public ProviderID() { }
public ProviderID(string name, string logo)

View File

@ -35,6 +35,13 @@ namespace Kyoo.Models
[LoadableRelation] public virtual ICollection<Episode> Episodes { get; set; }
[LoadableRelation] public virtual ICollection<Library> Libraries { get; set; }
[LoadableRelation] public virtual ICollection<Collection> Collections { get; set; }
#if ENABLE_INTERNAL_LINKS
[SerializeIgnore] public virtual ICollection<Link<Library, Show>> LibraryLinks { get; set; }
[SerializeIgnore] public virtual ICollection<Link<Collection, Show>> CollectionLinks { get; set; }
[SerializeIgnore] public virtual ICollection<Link<Show, Genre>> GenreLinks { get; set; }
#endif
public Show() { }

View File

@ -239,16 +239,25 @@ namespace Kyoo
return types.FirstOrDefault(x => x.IsGenericType && x.GetGenericTypeDefinition() == genericType);
}
public static async IAsyncEnumerable<T2> SelectAsync<T, T2>(this IEnumerable<T> self, Func<T, Task<T2>> mapper)
public static async IAsyncEnumerable<T2> SelectAsync<T, T2>([NotNull] this IEnumerable<T> self,
[NotNull] Func<T, Task<T2>> mapper)
{
if (self == null)
throw new ArgumentNullException(nameof(self));
if (mapper == null)
throw new ArgumentNullException(nameof(mapper));
using IEnumerator<T> enumerator = self.GetEnumerator();
while (enumerator.MoveNext())
yield return await mapper(enumerator.Current);
}
public static async Task<List<T>> ToListAsync<T>(this IAsyncEnumerable<T> self)
public static async Task<List<T>> ToListAsync<T>([NotNull] this IAsyncEnumerable<T> self)
{
if (self == null)
throw new ArgumentNullException(nameof(self));
List<T> ret = new();
await foreach(T i in self)
@ -482,11 +491,14 @@ namespace Kyoo
Type type = GetEnumerableType(eno);
if (typeof(IResource).IsAssignableFrom(type))
return ResourceEquals(eno.Cast<IResource>(), ens.Cast<IResource>());
Type genericDefinition = GetGenericDefinition(type, typeof(IResourceLink<,>));
if (genericDefinition == null)
return RunGenericMethod<bool>(typeof(Enumerable), "SequenceEqual", type, first, second);
Type[] types = genericDefinition.GetGenericArguments().Prepend(type).ToArray();
return RunGenericMethod<bool>(typeof(Utility), "LinkEquals", types, eno, ens);
return RunGenericMethod<bool>(typeof(Enumerable), "SequenceEqual", type, first, second);
}
public static void Test()
{
#if INTERNAL_LINKS
Console.WriteLine("Lib test");
#endif
}
public static bool ResourceEquals<T>([CanBeNull] T first, [CanBeNull] T second)
@ -522,20 +534,7 @@ namespace Kyoo
return true;
return firstID == secondID;
}
public static bool LinkEquals<T, T1, T2>([CanBeNull] IEnumerable<T> first, [CanBeNull] IEnumerable<T> second)
where T : IResourceLink<T1, T2>
where T1 : IResource
where T2 : IResource
{
if (ReferenceEquals(first, second))
return true;
if (first == null || second == null)
return false;
return first.SequenceEqual(second, new LinkComparer<T, T1, T2>());
}
public static Expression<T> Convert<T>([CanBeNull] this Expression expr)
where T : Delegate
{

View File

@ -18,7 +18,7 @@ namespace Kyoo.Controllers
private async Task<T> GetMetadata<T>(Func<IMetadataProvider, Task<T>> providerCall, Library library, string what)
where T : new()
{
T ret = new T();
T ret = new();
IEnumerable<IMetadataProvider> providers = library?.Providers
.Select(x => _providers.FirstOrDefault(y => y.Provider.Slug == x.Slug))

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Kyoo.Models;
using Kyoo.Models.Exceptions;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Kyoo.Controllers
@ -54,7 +55,10 @@ namespace Kyoo.Controllers
public override async Task<Library> Create(Library obj)
{
await base.Create(obj);
_database.Entry(obj).State = EntityState.Added;
// _database.Entry(obj).State = EntityState.Added;
// _database.Entry(obj).Collection(x => x.Providers).IsModified = true;
// _database.Add(obj);
// var a = EF.Property<ICollection<Link<LibraryDE, ProviderID>>>(obj, nameof(LibraryDE.LibraryLinks));
await _database.SaveChangesAsync($"Trying to insert a duplicated library (slug {obj.Slug} already exists).");
return obj;
}
@ -70,9 +74,12 @@ namespace Kyoo.Controllers
await base.Validate(resource);
resource.Providers = await resource.Providers
.SelectAsync(x => _providers.CreateIfNotExists(x, true))
.ToListAsync();
if (resource.Providers != null)
{
resource.Providers = await resource.Providers
.SelectAsync(x => _providers.CreateIfNotExists(x, true))
.ToListAsync();
}
}
public override async Task Delete(Library obj)

View File

@ -104,10 +104,13 @@ namespace Kyoo.Controllers
if (ShouldValidate(resource.Studio))
resource.Studio = await _studios.CreateIfNotExists(resource.Studio, true);
resource.Genres = await resource.Genres
.SelectAsync(x => _genres.CreateIfNotExists(x, true))
.ToListAsync();
if (resource.Genres != null)
{
resource.Genres = await resource.Genres
.SelectAsync(x => _genres.CreateIfNotExists(x, true))
.ToListAsync();
}
if (resource.People != null)
foreach (PeopleRole link in resource.People)
@ -125,25 +128,29 @@ namespace Kyoo.Controllers
Show show = await Get(showID);
if (collectionID != null)
{
Collection collection = _database.GetTemporaryObject(new Collection {ID = collectionID.Value});
show.Collections ??= new List<Collection>();
show.Collections.Add(new Collection {ID = collectionID.Value});
await _database.SaveChangesAsync();
show.Collections.Add(collection);
await _database.SaveIfNoDuplicates();
if (libraryID != null)
{
Library library = await _database.Libraries.FirstOrDefaultAsync(x => x.ID == libraryID.Value);
if (library == null)
throw new ItemNotFound($"No library found with the ID {libraryID.Value}");
library.Collections ??= new List<Collection>();
library.Collections.Add(collection);
await _database.SaveIfNoDuplicates();
}
}
if (libraryID != null)
{
Library library = _database.GetTemporaryObject(new Library {ID = libraryID.Value});
show.Libraries ??= new List<Library>();
show.Libraries.Add(new Library {ID = libraryID.Value});
await _database.SaveChangesAsync();
}
if (libraryID != null && collectionID != null)
{
Library library = await _database.Libraries.FirstOrDefaultAsync(x => x.ID == libraryID.Value);
if (library == null)
throw new ItemNotFound($"No library found with the ID {libraryID.Value}");
library.Collections ??= new List<Collection>();
library.Collections.Add(new Collection {ID = collectionID.Value});
await _database.SaveChangesAsync();
show.Libraries.Add(library);
await _database.SaveIfNoDuplicates();
}
}

View File

@ -10,8 +10,6 @@ using Npgsql;
namespace Kyoo
{
//TODO disable lazy loading a provide a LoadAsync method in the library manager.
public class DatabaseContext : DbContext
{
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
@ -28,6 +26,7 @@ namespace Kyoo
public DbSet<ProviderID> Providers { get; set; }
public DbSet<MetadataID> MetadataIds { get; set; }
// TODO Many to many with UsingEntity for this.
public DbSet<PeopleRole> PeopleRoles { get; set; }
@ -46,11 +45,6 @@ namespace Kyoo
modelBuilder.HasPostgresEnum<ItemType>();
modelBuilder.HasPostgresEnum<StreamType>();
modelBuilder.Ignore<Library>();
modelBuilder.Ignore<Collection>();
modelBuilder.Ignore<Show>();
modelBuilder.Ignore<Genre>();
modelBuilder.Entity<Library>()
.Property(x => x.Paths)
.HasColumnType("text[]");
@ -67,6 +61,67 @@ namespace Kyoo
.Property(t => t.IsForced)
.ValueGeneratedNever();
modelBuilder.Entity<ProviderID>()
.HasMany(x => x.Libraries)
.WithMany(x => x.Providers)
.UsingEntity<Link<Library, ProviderID>>(
y => y
.HasOne(x => x.First)
.WithMany(x => x.ProviderLinks),
y => y
.HasOne(x => x.Second)
.WithMany(x => x.LibraryLinks),
y => y.HasKey(x => Link<Library, ProviderID>.PrimaryKey));
modelBuilder.Entity<Collection>()
.HasMany(x => x.Libraries)
.WithMany(x => x.Collections)
.UsingEntity<Link<Library, Collection>>(
y => y
.HasOne(x => x.First)
.WithMany(x => x.CollectionLinks),
y => y
.HasOne(x => x.Second)
.WithMany(x => x.LibraryLinks),
y => y.HasKey(x => Link<Library, Collection>.PrimaryKey));
modelBuilder.Entity<Show>()
.HasMany(x => x.Libraries)
.WithMany(x => x.Shows)
.UsingEntity<Link<Library, Show>>(
y => y
.HasOne(x => x.First)
.WithMany(x => x.ShowLinks),
y => y
.HasOne(x => x.Second)
.WithMany(x => x.LibraryLinks),
y => y.HasKey(x => Link<Library, Show>.PrimaryKey));
modelBuilder.Entity<Show>()
.HasMany(x => x.Collections)
.WithMany(x => x.Shows)
.UsingEntity<Link<Collection, Show>>(
y => y
.HasOne(x => x.First)
.WithMany(x => x.ShowLinks),
y => y
.HasOne(x => x.Second)
.WithMany(x => x.CollectionLinks),
y => y.HasKey(x => Link<Collection, Show>.PrimaryKey));
modelBuilder.Entity<Genre>()
.HasMany(x => x.Shows)
.WithMany(x => x.Genres)
.UsingEntity<Link<Show, Genre>>(
y => y
.HasOne(x => x.First)
.WithMany(x => x.GenreLinks),
y => y
.HasOne(x => x.Second)
.WithMany(x => x.ShowLinks),
y => y.HasKey(x => Link<Show, Genre>.PrimaryKey));
modelBuilder.Entity<MetadataID>()
.HasOne(x => x.Show)
.WithMany(x => x.ExternalIDs)
@ -121,6 +176,16 @@ namespace Kyoo
.IsUnique();
}
public T GetTemporaryObject<T>(T model)
where T : class, IResource
{
T tmp = Set<T>().Local.FirstOrDefault(x => x.ID == model.ID);
if (tmp != null)
return tmp;
Entry(model).State = EntityState.Unchanged;
return model;
}
public override int SaveChanges()
{
try

View File

@ -1,985 +0,0 @@
// <auto-generated />
using System;
using IdentityServer4.EntityFramework.DbContexts;
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.IdentityConfiguration
{
[DbContext(typeof(ConfigurationDbContext))]
[Migration("20210216205007_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AllowedAccessTokenSigningAlgorithms")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("DisplayName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiResources");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceScopes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(4000)
.HasColumnType("character varying(4000)");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceSecrets");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("DisplayName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiScopes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ScopeId");
b.ToTable("ApiScopeClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ScopeId");
b.ToTable("ApiScopeProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenType")
.HasColumnType("integer");
b.Property<bool>("AllowAccessTokensViaBrowser")
.HasColumnType("boolean");
b.Property<bool>("AllowOfflineAccess")
.HasColumnType("boolean");
b.Property<bool>("AllowPlainTextPkce")
.HasColumnType("boolean");
b.Property<bool>("AllowRememberConsent")
.HasColumnType("boolean");
b.Property<string>("AllowedIdentityTokenSigningAlgorithms")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("boolean");
b.Property<bool>("AlwaysSendClientClaims")
.HasColumnType("boolean");
b.Property<int>("AuthorizationCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("BackChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientUri")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<int?>("ConsentLifetime")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<int>("DeviceCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("EnableLocalLogin")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<bool>("FrontChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<int>("IdentityTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("IncludeJwtId")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<int>("RefreshTokenExpiration")
.HasColumnType("integer");
b.Property<int>("RefreshTokenUsage")
.HasColumnType("integer");
b.Property<bool>("RequireClientSecret")
.HasColumnType("boolean");
b.Property<bool>("RequireConsent")
.HasColumnType("boolean");
b.Property<bool>("RequirePkce")
.HasColumnType("boolean");
b.Property<bool>("RequireRequestObject")
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int?>("UserSsoLifetime")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("Clients");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Origin")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientCorsOrigins");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("GrantType")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientGrantTypes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Provider")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientIdPRestrictions");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientPostLogoutRedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("RedirectUri")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientRedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientScopes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(4000)
.HasColumnType("character varying(4000)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientSecrets");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("DisplayName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("IdentityResources");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApiResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Properties")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApiResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApiResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApiResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope")
.WithMany("UserClaims")
.HasForeignKey("ScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Scope");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope")
.WithMany("Properties")
.HasForeignKey("ScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Scope");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("IdentityResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("Properties")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("IdentityResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{
b.Navigation("Properties");
b.Navigation("Scopes");
b.Navigation("Secrets");
b.Navigation("UserClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b =>
{
b.Navigation("Properties");
b.Navigation("UserClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b =>
{
b.Navigation("AllowedCorsOrigins");
b.Navigation("AllowedGrantTypes");
b.Navigation("AllowedScopes");
b.Navigation("Claims");
b.Navigation("ClientSecrets");
b.Navigation("IdentityProviderRestrictions");
b.Navigation("PostLogoutRedirectUris");
b.Navigation("Properties");
b.Navigation("RedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b =>
{
b.Navigation("Properties");
b.Navigation("UserClaims");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,658 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.IdentityConfiguration
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ApiResources",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DisplayName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
AllowedAccessTokenSigningAlgorithms = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
ShowInDiscoveryDocument = table.Column<bool>(type: "boolean", nullable: false),
Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Updated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
LastAccessed = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
NonEditable = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ApiScopes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DisplayName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
Required = table.Column<bool>(type: "boolean", nullable: false),
Emphasize = table.Column<bool>(type: "boolean", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiScopes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Clients",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
ClientId = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
ProtocolType = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
RequireClientSecret = table.Column<bool>(type: "boolean", nullable: false),
ClientName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
ClientUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
LogoUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
RequireConsent = table.Column<bool>(type: "boolean", nullable: false),
AllowRememberConsent = table.Column<bool>(type: "boolean", nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "boolean", nullable: false),
RequirePkce = table.Column<bool>(type: "boolean", nullable: false),
AllowPlainTextPkce = table.Column<bool>(type: "boolean", nullable: false),
RequireRequestObject = table.Column<bool>(type: "boolean", nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(type: "boolean", nullable: false),
FrontChannelLogoutUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
FrontChannelLogoutSessionRequired = table.Column<bool>(type: "boolean", nullable: false),
BackChannelLogoutUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
BackChannelLogoutSessionRequired = table.Column<bool>(type: "boolean", nullable: false),
AllowOfflineAccess = table.Column<bool>(type: "boolean", nullable: false),
IdentityTokenLifetime = table.Column<int>(type: "integer", nullable: false),
AllowedIdentityTokenSigningAlgorithms = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
AccessTokenLifetime = table.Column<int>(type: "integer", nullable: false),
AuthorizationCodeLifetime = table.Column<int>(type: "integer", nullable: false),
ConsentLifetime = table.Column<int>(type: "integer", nullable: true),
AbsoluteRefreshTokenLifetime = table.Column<int>(type: "integer", nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(type: "integer", nullable: false),
RefreshTokenUsage = table.Column<int>(type: "integer", nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "boolean", nullable: false),
RefreshTokenExpiration = table.Column<int>(type: "integer", nullable: false),
AccessTokenType = table.Column<int>(type: "integer", nullable: false),
EnableLocalLogin = table.Column<bool>(type: "boolean", nullable: false),
IncludeJwtId = table.Column<bool>(type: "boolean", nullable: false),
AlwaysSendClientClaims = table.Column<bool>(type: "boolean", nullable: false),
ClientClaimsPrefix = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
PairWiseSubjectSalt = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Updated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
LastAccessed = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
UserSsoLifetime = table.Column<int>(type: "integer", nullable: true),
UserCodeType = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
DeviceCodeLifetime = table.Column<int>(type: "integer", nullable: false),
NonEditable = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clients", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityResources",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DisplayName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
Required = table.Column<bool>(type: "boolean", nullable: false),
Emphasize = table.Column<bool>(type: "boolean", nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(type: "boolean", nullable: false),
Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Updated = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
NonEditable = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ApiResourceClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ApiResourceId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiResourceClaims", x => x.Id);
table.ForeignKey(
name: "FK_ApiResourceClaims_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiResourceProperties",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ApiResourceId = table.Column<int>(type: "integer", nullable: false),
Key = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiResourceProperties", x => x.Id);
table.ForeignKey(
name: "FK_ApiResourceProperties_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiResourceScopes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Scope = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
ApiResourceId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiResourceScopes", x => x.Id);
table.ForeignKey(
name: "FK_ApiResourceScopes_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiResourceSecrets",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ApiResourceId = table.Column<int>(type: "integer", nullable: false),
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
Value = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Type = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiResourceSecrets", x => x.Id);
table.ForeignKey(
name: "FK_ApiResourceSecrets_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiScopeClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ScopeId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiScopeClaims", x => x.Id);
table.ForeignKey(
name: "FK_ApiScopeClaims_ApiScopes_ScopeId",
column: x => x.ScopeId,
principalTable: "ApiScopes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiScopeProperties",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ScopeId = table.Column<int>(type: "integer", nullable: false),
Key = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiScopeProperties", x => x.Id);
table.ForeignKey(
name: "FK_ApiScopeProperties_ApiScopes_ScopeId",
column: x => x.ScopeId,
principalTable: "ApiScopes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientClaims", x => x.Id);
table.ForeignKey(
name: "FK_ClientClaims_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientCorsOrigins",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Origin = table.Column<string>(type: "character varying(150)", maxLength: 150, nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientCorsOrigins", x => x.Id);
table.ForeignKey(
name: "FK_ClientCorsOrigins_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientGrantTypes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
GrantType = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientGrantTypes", x => x.Id);
table.ForeignKey(
name: "FK_ClientGrantTypes_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientIdPRestrictions",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Provider = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientIdPRestrictions", x => x.Id);
table.ForeignKey(
name: "FK_ClientIdPRestrictions_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientPostLogoutRedirectUris",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PostLogoutRedirectUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientPostLogoutRedirectUris", x => x.Id);
table.ForeignKey(
name: "FK_ClientPostLogoutRedirectUris_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientProperties",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ClientId = table.Column<int>(type: "integer", nullable: false),
Key = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientProperties", x => x.Id);
table.ForeignKey(
name: "FK_ClientProperties_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientRedirectUris",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RedirectUri = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientRedirectUris", x => x.Id);
table.ForeignKey(
name: "FK_ClientRedirectUris_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientScopes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Scope = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientScopes", x => x.Id);
table.ForeignKey(
name: "FK_ClientScopes_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientSecrets",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ClientId = table.Column<int>(type: "integer", nullable: false),
Description = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
Value = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Type = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientSecrets", x => x.Id);
table.ForeignKey(
name: "FK_ClientSecrets_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityResourceClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
IdentityResourceId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityResourceClaims", x => x.Id);
table.ForeignKey(
name: "FK_IdentityResourceClaims_IdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityResourceProperties",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
IdentityResourceId = table.Column<int>(type: "integer", nullable: false),
Key = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityResourceProperties", x => x.Id);
table.ForeignKey(
name: "FK_IdentityResourceProperties_IdentityResources_IdentityResour~",
column: x => x.IdentityResourceId,
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ApiResourceClaims_ApiResourceId",
table: "ApiResourceClaims",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiResourceProperties_ApiResourceId",
table: "ApiResourceProperties",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiResources_Name",
table: "ApiResources",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiResourceScopes_ApiResourceId",
table: "ApiResourceScopes",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiResourceSecrets_ApiResourceId",
table: "ApiResourceSecrets",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ScopeId",
table: "ApiScopeClaims",
column: "ScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopeProperties_ScopeId",
table: "ApiScopeProperties",
column: "ScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopes_Name",
table: "ApiScopes",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientClaims_ClientId",
table: "ClientClaims",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientCorsOrigins_ClientId",
table: "ClientCorsOrigins",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientGrantTypes_ClientId",
table: "ClientGrantTypes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientIdPRestrictions_ClientId",
table: "ClientIdPRestrictions",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientPostLogoutRedirectUris_ClientId",
table: "ClientPostLogoutRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientProperties_ClientId",
table: "ClientProperties",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientRedirectUris_ClientId",
table: "ClientRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Clients_ClientId",
table: "Clients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientScopes_ClientId",
table: "ClientScopes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientSecrets_ClientId",
table: "ClientSecrets",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_IdentityResourceClaims_IdentityResourceId",
table: "IdentityResourceClaims",
column: "IdentityResourceId");
migrationBuilder.CreateIndex(
name: "IX_IdentityResourceProperties_IdentityResourceId",
table: "IdentityResourceProperties",
column: "IdentityResourceId");
migrationBuilder.CreateIndex(
name: "IX_IdentityResources_Name",
table: "IdentityResources",
column: "Name",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ApiResourceClaims");
migrationBuilder.DropTable(
name: "ApiResourceProperties");
migrationBuilder.DropTable(
name: "ApiResourceScopes");
migrationBuilder.DropTable(
name: "ApiResourceSecrets");
migrationBuilder.DropTable(
name: "ApiScopeClaims");
migrationBuilder.DropTable(
name: "ApiScopeProperties");
migrationBuilder.DropTable(
name: "ClientClaims");
migrationBuilder.DropTable(
name: "ClientCorsOrigins");
migrationBuilder.DropTable(
name: "ClientGrantTypes");
migrationBuilder.DropTable(
name: "ClientIdPRestrictions");
migrationBuilder.DropTable(
name: "ClientPostLogoutRedirectUris");
migrationBuilder.DropTable(
name: "ClientProperties");
migrationBuilder.DropTable(
name: "ClientRedirectUris");
migrationBuilder.DropTable(
name: "ClientScopes");
migrationBuilder.DropTable(
name: "ClientSecrets");
migrationBuilder.DropTable(
name: "IdentityResourceClaims");
migrationBuilder.DropTable(
name: "IdentityResourceProperties");
migrationBuilder.DropTable(
name: "ApiResources");
migrationBuilder.DropTable(
name: "ApiScopes");
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "IdentityResources");
}
}
}

View File

@ -1,983 +0,0 @@
// <auto-generated />
using System;
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.IdentityConfiguration
{
[DbContext(typeof(ConfigurationDbContext))]
partial class ConfigurationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AllowedAccessTokenSigningAlgorithms")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("DisplayName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiResources");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceScopes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(4000)
.HasColumnType("character varying(4000)");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceSecrets");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("DisplayName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiScopes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ScopeId");
b.ToTable("ApiScopeClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ScopeId");
b.ToTable("ApiScopeProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenType")
.HasColumnType("integer");
b.Property<bool>("AllowAccessTokensViaBrowser")
.HasColumnType("boolean");
b.Property<bool>("AllowOfflineAccess")
.HasColumnType("boolean");
b.Property<bool>("AllowPlainTextPkce")
.HasColumnType("boolean");
b.Property<bool>("AllowRememberConsent")
.HasColumnType("boolean");
b.Property<string>("AllowedIdentityTokenSigningAlgorithms")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("boolean");
b.Property<bool>("AlwaysSendClientClaims")
.HasColumnType("boolean");
b.Property<int>("AuthorizationCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("BackChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<string>("ClientClaimsPrefix")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientUri")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<int?>("ConsentLifetime")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<int>("DeviceCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("EnableLocalLogin")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<bool>("FrontChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<int>("IdentityTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("IncludeJwtId")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ProtocolType")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<int>("RefreshTokenExpiration")
.HasColumnType("integer");
b.Property<int>("RefreshTokenUsage")
.HasColumnType("integer");
b.Property<bool>("RequireClientSecret")
.HasColumnType("boolean");
b.Property<bool>("RequireConsent")
.HasColumnType("boolean");
b.Property<bool>("RequirePkce")
.HasColumnType("boolean");
b.Property<bool>("RequireRequestObject")
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int?>("UserSsoLifetime")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("Clients");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Origin")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientCorsOrigins");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("GrantType")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientGrantTypes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Provider")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientIdPRestrictions");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientPostLogoutRedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("RedirectUri")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientRedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientScopes");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(4000)
.HasColumnType("character varying(4000)");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientSecrets");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<string>("DisplayName")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("IdentityResources");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceProperties");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApiResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Properties")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApiResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApiResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApiResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope")
.WithMany("UserClaims")
.HasForeignKey("ScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Scope");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "Scope")
.WithMany("Properties")
.HasForeignKey("ScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Scope");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("IdentityResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("Properties")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("IdentityResource");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
{
b.Navigation("Properties");
b.Navigation("Scopes");
b.Navigation("Secrets");
b.Navigation("UserClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b =>
{
b.Navigation("Properties");
b.Navigation("UserClaims");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b =>
{
b.Navigation("AllowedCorsOrigins");
b.Navigation("AllowedGrantTypes");
b.Navigation("AllowedScopes");
b.Navigation("Claims");
b.Navigation("ClientSecrets");
b.Navigation("IdentityProviderRestrictions");
b.Navigation("PostLogoutRedirectUris");
b.Navigation("Properties");
b.Navigation("RedirectUris");
});
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b =>
{
b.Navigation("Properties");
b.Navigation("UserClaims");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,778 +0,0 @@
// <auto-generated />
using System;
using Kyoo;
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("20210228232014_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" })
.HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "font" })
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("CollectionLibrary", b =>
{
b.Property<int>("CollectionsID")
.HasColumnType("integer");
b.Property<int>("LibrariesID")
.HasColumnType("integer");
b.HasKey("CollectionsID", "LibrariesID");
b.HasIndex("LibrariesID");
b.ToTable("CollectionLibrary");
});
modelBuilder.Entity("CollectionShow", b =>
{
b.Property<int>("CollectionsID")
.HasColumnType("integer");
b.Property<int>("ShowsID")
.HasColumnType("integer");
b.HasKey("CollectionsID", "ShowsID");
b.HasIndex("ShowsID");
b.ToTable("CollectionShow");
});
modelBuilder.Entity("GenreShow", b =>
{
b.Property<int>("GenresID")
.HasColumnType("integer");
b.Property<int>("ShowsID")
.HasColumnType("integer");
b.HasKey("GenresID", "ShowsID");
b.HasIndex("ShowsID");
b.ToTable("GenreShow");
});
modelBuilder.Entity("Kyoo.Models.Collection", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Collections");
});
modelBuilder.Entity("Kyoo.Models.Episode", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteNumber")
.HasColumnType("integer");
b.Property<int>("EpisodeNumber")
.HasColumnType("integer");
b.Property<string>("Overview")
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<DateTime?>("ReleaseDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Runtime")
.HasColumnType("integer");
b.Property<int?>("SeasonID")
.HasColumnType("integer");
b.Property<int>("SeasonNumber")
.HasColumnType("integer");
b.Property<int>("ShowID")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("SeasonID");
b.HasIndex("ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber")
.IsUnique();
b.ToTable("Episodes");
});
modelBuilder.Entity("Kyoo.Models.Genre", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Genres");
});
modelBuilder.Entity("Kyoo.Models.Library", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string[]>("Paths")
.HasColumnType("text[]");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Libraries");
});
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int?>("CollectionID")
.HasColumnType("integer");
b.Property<int>("LibraryID")
.HasColumnType("integer");
b.Property<int?>("ShowID")
.HasColumnType("integer");
b.HasKey("ID");
b.HasIndex("CollectionID");
b.HasIndex("ShowID");
b.HasIndex("LibraryID", "CollectionID")
.IsUnique();
b.HasIndex("LibraryID", "ShowID")
.IsUnique();
b.ToTable("LibraryLink");
});
modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("DataID")
.HasColumnType("text");
b.Property<int?>("EpisodeID")
.HasColumnType("integer");
b.Property<string>("Link")
.HasColumnType("text");
b.Property<int?>("PeopleID")
.HasColumnType("integer");
b.Property<int>("ProviderID")
.HasColumnType("integer");
b.Property<int?>("SeasonID")
.HasColumnType("integer");
b.Property<int?>("ShowID")
.HasColumnType("integer");
b.HasKey("ID");
b.HasIndex("EpisodeID");
b.HasIndex("PeopleID");
b.HasIndex("ProviderID");
b.HasIndex("SeasonID");
b.HasIndex("ShowID");
b.ToTable("MetadataIds");
});
modelBuilder.Entity("Kyoo.Models.People", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("People");
});
modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("PeopleID")
.HasColumnType("integer");
b.Property<string>("Role")
.HasColumnType("text");
b.Property<int>("ShowID")
.HasColumnType("integer");
b.Property<string>("Type")
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("PeopleID");
b.HasIndex("ShowID");
b.ToTable("PeopleRoles");
});
modelBuilder.Entity("Kyoo.Models.ProviderID", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Logo")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Providers");
});
modelBuilder.Entity("Kyoo.Models.Season", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Overview")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<int>("SeasonNumber")
.HasColumnType("integer");
b.Property<int>("ShowID")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.Property<int?>("Year")
.HasColumnType("integer");
b.HasKey("ID");
b.HasIndex("ShowID", "SeasonNumber")
.IsUnique();
b.ToTable("Seasons");
});
modelBuilder.Entity("Kyoo.Models.Show", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string[]>("Aliases")
.HasColumnType("text[]");
b.Property<string>("Backdrop")
.HasColumnType("text");
b.Property<int?>("EndYear")
.HasColumnType("integer");
b.Property<bool>("IsMovie")
.HasColumnType("boolean");
b.Property<string>("Logo")
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("StartYear")
.HasColumnType("integer");
b.Property<int?>("Status")
.HasColumnType("integer");
b.Property<int?>("StudioID")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.Property<string>("TrailerUrl")
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.HasIndex("StudioID");
b.ToTable("Shows");
});
modelBuilder.Entity("Kyoo.Models.Studio", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Studios");
});
modelBuilder.Entity("Kyoo.Models.Track", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Codec")
.HasColumnType("text");
b.Property<int>("EpisodeID")
.HasColumnType("integer");
b.Property<bool>("IsDefault")
.HasColumnType("boolean");
b.Property<bool>("IsExternal")
.HasColumnType("boolean");
b.Property<bool>("IsForced")
.HasColumnType("boolean");
b.Property<string>("Language")
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("text");
b.Property<string>("Title")
.HasColumnType("text");
b.Property<int>("Type")
.HasColumnType("integer");
b.HasKey("ID");
b.HasIndex("EpisodeID");
b.ToTable("Tracks");
});
modelBuilder.Entity("LibraryProviderID", b =>
{
b.Property<int>("LibrariesID")
.HasColumnType("integer");
b.Property<int>("ProvidersID")
.HasColumnType("integer");
b.HasKey("LibrariesID", "ProvidersID");
b.HasIndex("ProvidersID");
b.ToTable("LibraryProviderID");
});
modelBuilder.Entity("LibraryShow", b =>
{
b.Property<int>("LibrariesID")
.HasColumnType("integer");
b.Property<int>("ShowsID")
.HasColumnType("integer");
b.HasKey("LibrariesID", "ShowsID");
b.HasIndex("ShowsID");
b.ToTable("LibraryShow");
});
modelBuilder.Entity("CollectionLibrary", b =>
{
b.HasOne("Kyoo.Models.Collection", null)
.WithMany()
.HasForeignKey("CollectionsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Library", null)
.WithMany()
.HasForeignKey("LibrariesID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CollectionShow", b =>
{
b.HasOne("Kyoo.Models.Collection", null)
.WithMany()
.HasForeignKey("CollectionsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", null)
.WithMany()
.HasForeignKey("ShowsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("GenreShow", b =>
{
b.HasOne("Kyoo.Models.Genre", null)
.WithMany()
.HasForeignKey("GenresID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", null)
.WithMany()
.HasForeignKey("ShowsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Kyoo.Models.Episode", b =>
{
b.HasOne("Kyoo.Models.Season", "Season")
.WithMany("Episodes")
.HasForeignKey("SeasonID");
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany("Episodes")
.HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Season");
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
{
b.HasOne("Kyoo.Models.Collection", "Collection")
.WithMany()
.HasForeignKey("CollectionID");
b.HasOne("Kyoo.Models.Library", "Library")
.WithMany()
.HasForeignKey("LibraryID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany()
.HasForeignKey("ShowID");
b.Navigation("Collection");
b.Navigation("Library");
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
{
b.HasOne("Kyoo.Models.Episode", "Episode")
.WithMany("ExternalIDs")
.HasForeignKey("EpisodeID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.People", "People")
.WithMany("ExternalIDs")
.HasForeignKey("PeopleID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.ProviderID", "Provider")
.WithMany()
.HasForeignKey("ProviderID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Season", "Season")
.WithMany("ExternalIDs")
.HasForeignKey("SeasonID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany("ExternalIDs")
.HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("Episode");
b.Navigation("People");
b.Navigation("Provider");
b.Navigation("Season");
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
{
b.HasOne("Kyoo.Models.People", "People")
.WithMany("Roles")
.HasForeignKey("PeopleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany("People")
.HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("People");
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.Season", b =>
{
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany("Seasons")
.HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.Show", b =>
{
b.HasOne("Kyoo.Models.Studio", "Studio")
.WithMany("Shows")
.HasForeignKey("StudioID");
b.Navigation("Studio");
});
modelBuilder.Entity("Kyoo.Models.Track", b =>
{
b.HasOne("Kyoo.Models.Episode", "Episode")
.WithMany("Tracks")
.HasForeignKey("EpisodeID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Episode");
});
modelBuilder.Entity("LibraryProviderID", b =>
{
b.HasOne("Kyoo.Models.Library", null)
.WithMany()
.HasForeignKey("LibrariesID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.ProviderID", null)
.WithMany()
.HasForeignKey("ProvidersID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LibraryShow", b =>
{
b.HasOne("Kyoo.Models.Library", null)
.WithMany()
.HasForeignKey("LibrariesID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", null)
.WithMany()
.HasForeignKey("ShowsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Kyoo.Models.Episode", b =>
{
b.Navigation("ExternalIDs");
b.Navigation("Tracks");
});
modelBuilder.Entity("Kyoo.Models.People", b =>
{
b.Navigation("ExternalIDs");
b.Navigation("Roles");
});
modelBuilder.Entity("Kyoo.Models.Season", b =>
{
b.Navigation("Episodes");
b.Navigation("ExternalIDs");
});
modelBuilder.Entity("Kyoo.Models.Show", b =>
{
b.Navigation("Episodes");
b.Navigation("ExternalIDs");
b.Navigation("People");
b.Navigation("Seasons");
});
modelBuilder.Entity("Kyoo.Models.Studio", b =>
{
b.Navigation("Shows");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,662 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:Enum:item_type", "show,movie,collection")
.Annotation("Npgsql:Enum:status", "finished,airing,planned,unknown")
.Annotation("Npgsql:Enum:stream_type", "unknown,video,audio,subtitle,font");
migrationBuilder.CreateTable(
name: "Collections",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
Poster = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Collections", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Genres",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Genres", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Libraries",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
Paths = table.Column<string[]>(type: "text[]", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Libraries", x => x.ID);
});
migrationBuilder.CreateTable(
name: "People",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
Poster = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_People", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Providers",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true),
Logo = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Providers", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Studios",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Studios", x => x.ID);
});
migrationBuilder.CreateTable(
name: "CollectionLibrary",
columns: table => new
{
CollectionsID = table.Column<int>(type: "integer", nullable: false),
LibrariesID = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CollectionLibrary", x => new { x.CollectionsID, x.LibrariesID });
table.ForeignKey(
name: "FK_CollectionLibrary_Collections_CollectionsID",
column: x => x.CollectionsID,
principalTable: "Collections",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CollectionLibrary_Libraries_LibrariesID",
column: x => x.LibrariesID,
principalTable: "Libraries",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LibraryProviderID",
columns: table => new
{
LibrariesID = table.Column<int>(type: "integer", nullable: false),
ProvidersID = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LibraryProviderID", x => new { x.LibrariesID, x.ProvidersID });
table.ForeignKey(
name: "FK_LibraryProviderID_Libraries_LibrariesID",
column: x => x.LibrariesID,
principalTable: "Libraries",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LibraryProviderID_Providers_ProvidersID",
column: x => x.ProvidersID,
principalTable: "Providers",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Shows",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Slug = table.Column<string>(type: "text", nullable: false),
Title = table.Column<string>(type: "text", nullable: true),
Aliases = table.Column<string[]>(type: "text[]", nullable: true),
Path = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(type: "text", nullable: true),
Status = table.Column<int>(type: "integer", nullable: true),
TrailerUrl = table.Column<string>(type: "text", nullable: true),
StartYear = table.Column<int>(type: "integer", nullable: true),
EndYear = table.Column<int>(type: "integer", nullable: true),
Poster = table.Column<string>(type: "text", nullable: true),
Logo = table.Column<string>(type: "text", nullable: true),
Backdrop = table.Column<string>(type: "text", nullable: true),
IsMovie = table.Column<bool>(type: "boolean", nullable: false),
StudioID = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Shows", x => x.ID);
table.ForeignKey(
name: "FK_Shows_Studios_StudioID",
column: x => x.StudioID,
principalTable: "Studios",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "CollectionShow",
columns: table => new
{
CollectionsID = table.Column<int>(type: "integer", nullable: false),
ShowsID = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CollectionShow", x => new { x.CollectionsID, x.ShowsID });
table.ForeignKey(
name: "FK_CollectionShow_Collections_CollectionsID",
column: x => x.CollectionsID,
principalTable: "Collections",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CollectionShow_Shows_ShowsID",
column: x => x.ShowsID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GenreShow",
columns: table => new
{
GenresID = table.Column<int>(type: "integer", nullable: false),
ShowsID = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GenreShow", x => new { x.GenresID, x.ShowsID });
table.ForeignKey(
name: "FK_GenreShow_Genres_GenresID",
column: x => x.GenresID,
principalTable: "Genres",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GenreShow_Shows_ShowsID",
column: x => x.ShowsID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LibraryLink",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
LibraryID = table.Column<int>(type: "integer", nullable: false),
ShowID = table.Column<int>(type: "integer", nullable: true),
CollectionID = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LibraryLink", x => x.ID);
table.ForeignKey(
name: "FK_LibraryLink_Collections_CollectionID",
column: x => x.CollectionID,
principalTable: "Collections",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_LibraryLink_Libraries_LibraryID",
column: x => x.LibraryID,
principalTable: "Libraries",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LibraryLink_Shows_ShowID",
column: x => x.ShowID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "LibraryShow",
columns: table => new
{
LibrariesID = table.Column<int>(type: "integer", nullable: false),
ShowsID = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LibraryShow", x => new { x.LibrariesID, x.ShowsID });
table.ForeignKey(
name: "FK_LibraryShow_Libraries_LibrariesID",
column: x => x.LibrariesID,
principalTable: "Libraries",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LibraryShow_Shows_ShowsID",
column: x => x.ShowsID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "PeopleRoles",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PeopleID = table.Column<int>(type: "integer", nullable: false),
ShowID = table.Column<int>(type: "integer", nullable: false),
Role = table.Column<string>(type: "text", nullable: true),
Type = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PeopleRoles", x => x.ID);
table.ForeignKey(
name: "FK_PeopleRoles_People_PeopleID",
column: x => x.PeopleID,
principalTable: "People",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_PeopleRoles_Shows_ShowID",
column: x => x.ShowID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Seasons",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ShowID = table.Column<int>(type: "integer", nullable: false),
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
Title = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(type: "text", nullable: true),
Year = table.Column<int>(type: "integer", nullable: true),
Poster = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Seasons", x => x.ID);
table.ForeignKey(
name: "FK_Seasons_Shows_ShowID",
column: x => x.ShowID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Episodes",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ShowID = table.Column<int>(type: "integer", nullable: false),
SeasonID = table.Column<int>(type: "integer", nullable: true),
SeasonNumber = table.Column<int>(type: "integer", nullable: false),
EpisodeNumber = table.Column<int>(type: "integer", nullable: false),
AbsoluteNumber = table.Column<int>(type: "integer", nullable: false),
Path = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(type: "text", nullable: true),
ReleaseDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Runtime = table.Column<int>(type: "integer", nullable: false),
Poster = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Episodes", x => x.ID);
table.ForeignKey(
name: "FK_Episodes_Seasons_SeasonID",
column: x => x.SeasonID,
principalTable: "Seasons",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Episodes_Shows_ShowID",
column: x => x.ShowID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MetadataIds",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProviderID = table.Column<int>(type: "integer", nullable: false),
ShowID = table.Column<int>(type: "integer", nullable: true),
EpisodeID = table.Column<int>(type: "integer", nullable: true),
SeasonID = table.Column<int>(type: "integer", nullable: true),
PeopleID = table.Column<int>(type: "integer", nullable: true),
DataID = table.Column<string>(type: "text", nullable: true),
Link = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MetadataIds", x => x.ID);
table.ForeignKey(
name: "FK_MetadataIds_Episodes_EpisodeID",
column: x => x.EpisodeID,
principalTable: "Episodes",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataIds_People_PeopleID",
column: x => x.PeopleID,
principalTable: "People",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataIds_Providers_ProviderID",
column: x => x.ProviderID,
principalTable: "Providers",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataIds_Seasons_SeasonID",
column: x => x.SeasonID,
principalTable: "Seasons",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataIds_Shows_ShowID",
column: x => x.ShowID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Tracks",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
EpisodeID = table.Column<int>(type: "integer", nullable: false),
IsDefault = table.Column<bool>(type: "boolean", nullable: false),
IsForced = table.Column<bool>(type: "boolean", nullable: false),
IsExternal = table.Column<bool>(type: "boolean", nullable: false),
Title = table.Column<string>(type: "text", nullable: true),
Language = table.Column<string>(type: "text", nullable: true),
Codec = table.Column<string>(type: "text", nullable: true),
Path = table.Column<string>(type: "text", nullable: true),
Type = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tracks", x => x.ID);
table.ForeignKey(
name: "FK_Tracks_Episodes_EpisodeID",
column: x => x.EpisodeID,
principalTable: "Episodes",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CollectionLibrary_LibrariesID",
table: "CollectionLibrary",
column: "LibrariesID");
migrationBuilder.CreateIndex(
name: "IX_Collections_Slug",
table: "Collections",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_CollectionShow_ShowsID",
table: "CollectionShow",
column: "ShowsID");
migrationBuilder.CreateIndex(
name: "IX_Episodes_SeasonID",
table: "Episodes",
column: "SeasonID");
migrationBuilder.CreateIndex(
name: "IX_Episodes_ShowID_SeasonNumber_EpisodeNumber_AbsoluteNumber",
table: "Episodes",
columns: new[] { "ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Genres_Slug",
table: "Genres",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_GenreShow_ShowsID",
table: "GenreShow",
column: "ShowsID");
migrationBuilder.CreateIndex(
name: "IX_Libraries_Slug",
table: "Libraries",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LibraryLink_CollectionID",
table: "LibraryLink",
column: "CollectionID");
migrationBuilder.CreateIndex(
name: "IX_LibraryLink_LibraryID_CollectionID",
table: "LibraryLink",
columns: new[] { "LibraryID", "CollectionID" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LibraryLink_LibraryID_ShowID",
table: "LibraryLink",
columns: new[] { "LibraryID", "ShowID" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LibraryLink_ShowID",
table: "LibraryLink",
column: "ShowID");
migrationBuilder.CreateIndex(
name: "IX_LibraryProviderID_ProvidersID",
table: "LibraryProviderID",
column: "ProvidersID");
migrationBuilder.CreateIndex(
name: "IX_LibraryShow_ShowsID",
table: "LibraryShow",
column: "ShowsID");
migrationBuilder.CreateIndex(
name: "IX_MetadataIds_EpisodeID",
table: "MetadataIds",
column: "EpisodeID");
migrationBuilder.CreateIndex(
name: "IX_MetadataIds_PeopleID",
table: "MetadataIds",
column: "PeopleID");
migrationBuilder.CreateIndex(
name: "IX_MetadataIds_ProviderID",
table: "MetadataIds",
column: "ProviderID");
migrationBuilder.CreateIndex(
name: "IX_MetadataIds_SeasonID",
table: "MetadataIds",
column: "SeasonID");
migrationBuilder.CreateIndex(
name: "IX_MetadataIds_ShowID",
table: "MetadataIds",
column: "ShowID");
migrationBuilder.CreateIndex(
name: "IX_People_Slug",
table: "People",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_PeopleRoles_PeopleID",
table: "PeopleRoles",
column: "PeopleID");
migrationBuilder.CreateIndex(
name: "IX_PeopleRoles_ShowID",
table: "PeopleRoles",
column: "ShowID");
migrationBuilder.CreateIndex(
name: "IX_Providers_Slug",
table: "Providers",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Seasons_ShowID_SeasonNumber",
table: "Seasons",
columns: new[] { "ShowID", "SeasonNumber" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Shows_Slug",
table: "Shows",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Shows_StudioID",
table: "Shows",
column: "StudioID");
migrationBuilder.CreateIndex(
name: "IX_Studios_Slug",
table: "Studios",
column: "Slug",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Tracks_EpisodeID",
table: "Tracks",
column: "EpisodeID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CollectionLibrary");
migrationBuilder.DropTable(
name: "CollectionShow");
migrationBuilder.DropTable(
name: "GenreShow");
migrationBuilder.DropTable(
name: "LibraryLink");
migrationBuilder.DropTable(
name: "LibraryProviderID");
migrationBuilder.DropTable(
name: "LibraryShow");
migrationBuilder.DropTable(
name: "MetadataIds");
migrationBuilder.DropTable(
name: "PeopleRoles");
migrationBuilder.DropTable(
name: "Tracks");
migrationBuilder.DropTable(
name: "Genres");
migrationBuilder.DropTable(
name: "Collections");
migrationBuilder.DropTable(
name: "Libraries");
migrationBuilder.DropTable(
name: "Providers");
migrationBuilder.DropTable(
name: "People");
migrationBuilder.DropTable(
name: "Episodes");
migrationBuilder.DropTable(
name: "Seasons");
migrationBuilder.DropTable(
name: "Shows");
migrationBuilder.DropTable(
name: "Studios");
}
}
}

View File

@ -1,776 +0,0 @@
// <auto-generated />
using System;
using Kyoo;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Models.DatabaseMigrations.Internal
{
[DbContext(typeof(DatabaseContext))]
partial class DatabaseContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" })
.HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "font" })
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.3")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("CollectionLibrary", b =>
{
b.Property<int>("CollectionsID")
.HasColumnType("integer");
b.Property<int>("LibrariesID")
.HasColumnType("integer");
b.HasKey("CollectionsID", "LibrariesID");
b.HasIndex("LibrariesID");
b.ToTable("CollectionLibrary");
});
modelBuilder.Entity("CollectionShow", b =>
{
b.Property<int>("CollectionsID")
.HasColumnType("integer");
b.Property<int>("ShowsID")
.HasColumnType("integer");
b.HasKey("CollectionsID", "ShowsID");
b.HasIndex("ShowsID");
b.ToTable("CollectionShow");
});
modelBuilder.Entity("GenreShow", b =>
{
b.Property<int>("GenresID")
.HasColumnType("integer");
b.Property<int>("ShowsID")
.HasColumnType("integer");
b.HasKey("GenresID", "ShowsID");
b.HasIndex("ShowsID");
b.ToTable("GenreShow");
});
modelBuilder.Entity("Kyoo.Models.Collection", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Collections");
});
modelBuilder.Entity("Kyoo.Models.Episode", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteNumber")
.HasColumnType("integer");
b.Property<int>("EpisodeNumber")
.HasColumnType("integer");
b.Property<string>("Overview")
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<DateTime?>("ReleaseDate")
.HasColumnType("timestamp without time zone");
b.Property<int>("Runtime")
.HasColumnType("integer");
b.Property<int?>("SeasonID")
.HasColumnType("integer");
b.Property<int>("SeasonNumber")
.HasColumnType("integer");
b.Property<int>("ShowID")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("SeasonID");
b.HasIndex("ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber")
.IsUnique();
b.ToTable("Episodes");
});
modelBuilder.Entity("Kyoo.Models.Genre", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Genres");
});
modelBuilder.Entity("Kyoo.Models.Library", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string[]>("Paths")
.HasColumnType("text[]");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Libraries");
});
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int?>("CollectionID")
.HasColumnType("integer");
b.Property<int>("LibraryID")
.HasColumnType("integer");
b.Property<int?>("ShowID")
.HasColumnType("integer");
b.HasKey("ID");
b.HasIndex("CollectionID");
b.HasIndex("ShowID");
b.HasIndex("LibraryID", "CollectionID")
.IsUnique();
b.HasIndex("LibraryID", "ShowID")
.IsUnique();
b.ToTable("LibraryLink");
});
modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("DataID")
.HasColumnType("text");
b.Property<int?>("EpisodeID")
.HasColumnType("integer");
b.Property<string>("Link")
.HasColumnType("text");
b.Property<int?>("PeopleID")
.HasColumnType("integer");
b.Property<int>("ProviderID")
.HasColumnType("integer");
b.Property<int?>("SeasonID")
.HasColumnType("integer");
b.Property<int?>("ShowID")
.HasColumnType("integer");
b.HasKey("ID");
b.HasIndex("EpisodeID");
b.HasIndex("PeopleID");
b.HasIndex("ProviderID");
b.HasIndex("SeasonID");
b.HasIndex("ShowID");
b.ToTable("MetadataIds");
});
modelBuilder.Entity("Kyoo.Models.People", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("People");
});
modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("PeopleID")
.HasColumnType("integer");
b.Property<string>("Role")
.HasColumnType("text");
b.Property<int>("ShowID")
.HasColumnType("integer");
b.Property<string>("Type")
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("PeopleID");
b.HasIndex("ShowID");
b.ToTable("PeopleRoles");
});
modelBuilder.Entity("Kyoo.Models.ProviderID", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Logo")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Providers");
});
modelBuilder.Entity("Kyoo.Models.Season", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Overview")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<int>("SeasonNumber")
.HasColumnType("integer");
b.Property<int>("ShowID")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.Property<int?>("Year")
.HasColumnType("integer");
b.HasKey("ID");
b.HasIndex("ShowID", "SeasonNumber")
.IsUnique();
b.ToTable("Seasons");
});
modelBuilder.Entity("Kyoo.Models.Show", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string[]>("Aliases")
.HasColumnType("text[]");
b.Property<string>("Backdrop")
.HasColumnType("text");
b.Property<int?>("EndYear")
.HasColumnType("integer");
b.Property<bool>("IsMovie")
.HasColumnType("boolean");
b.Property<string>("Logo")
.HasColumnType("text");
b.Property<string>("Overview")
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("text");
b.Property<string>("Poster")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("StartYear")
.HasColumnType("integer");
b.Property<int?>("Status")
.HasColumnType("integer");
b.Property<int?>("StudioID")
.HasColumnType("integer");
b.Property<string>("Title")
.HasColumnType("text");
b.Property<string>("TrailerUrl")
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.HasIndex("StudioID");
b.ToTable("Shows");
});
modelBuilder.Entity("Kyoo.Models.Studio", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Slug")
.IsRequired()
.HasColumnType("text");
b.HasKey("ID");
b.HasIndex("Slug")
.IsUnique();
b.ToTable("Studios");
});
modelBuilder.Entity("Kyoo.Models.Track", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Codec")
.HasColumnType("text");
b.Property<int>("EpisodeID")
.HasColumnType("integer");
b.Property<bool>("IsDefault")
.HasColumnType("boolean");
b.Property<bool>("IsExternal")
.HasColumnType("boolean");
b.Property<bool>("IsForced")
.HasColumnType("boolean");
b.Property<string>("Language")
.HasColumnType("text");
b.Property<string>("Path")
.HasColumnType("text");
b.Property<string>("Title")
.HasColumnType("text");
b.Property<int>("Type")
.HasColumnType("integer");
b.HasKey("ID");
b.HasIndex("EpisodeID");
b.ToTable("Tracks");
});
modelBuilder.Entity("LibraryProviderID", b =>
{
b.Property<int>("LibrariesID")
.HasColumnType("integer");
b.Property<int>("ProvidersID")
.HasColumnType("integer");
b.HasKey("LibrariesID", "ProvidersID");
b.HasIndex("ProvidersID");
b.ToTable("LibraryProviderID");
});
modelBuilder.Entity("LibraryShow", b =>
{
b.Property<int>("LibrariesID")
.HasColumnType("integer");
b.Property<int>("ShowsID")
.HasColumnType("integer");
b.HasKey("LibrariesID", "ShowsID");
b.HasIndex("ShowsID");
b.ToTable("LibraryShow");
});
modelBuilder.Entity("CollectionLibrary", b =>
{
b.HasOne("Kyoo.Models.Collection", null)
.WithMany()
.HasForeignKey("CollectionsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Library", null)
.WithMany()
.HasForeignKey("LibrariesID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CollectionShow", b =>
{
b.HasOne("Kyoo.Models.Collection", null)
.WithMany()
.HasForeignKey("CollectionsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", null)
.WithMany()
.HasForeignKey("ShowsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("GenreShow", b =>
{
b.HasOne("Kyoo.Models.Genre", null)
.WithMany()
.HasForeignKey("GenresID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", null)
.WithMany()
.HasForeignKey("ShowsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Kyoo.Models.Episode", b =>
{
b.HasOne("Kyoo.Models.Season", "Season")
.WithMany("Episodes")
.HasForeignKey("SeasonID");
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany("Episodes")
.HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Season");
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
{
b.HasOne("Kyoo.Models.Collection", "Collection")
.WithMany()
.HasForeignKey("CollectionID");
b.HasOne("Kyoo.Models.Library", "Library")
.WithMany()
.HasForeignKey("LibraryID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany()
.HasForeignKey("ShowID");
b.Navigation("Collection");
b.Navigation("Library");
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
{
b.HasOne("Kyoo.Models.Episode", "Episode")
.WithMany("ExternalIDs")
.HasForeignKey("EpisodeID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.People", "People")
.WithMany("ExternalIDs")
.HasForeignKey("PeopleID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.ProviderID", "Provider")
.WithMany()
.HasForeignKey("ProviderID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Season", "Season")
.WithMany("ExternalIDs")
.HasForeignKey("SeasonID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany("ExternalIDs")
.HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("Episode");
b.Navigation("People");
b.Navigation("Provider");
b.Navigation("Season");
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
{
b.HasOne("Kyoo.Models.People", "People")
.WithMany("Roles")
.HasForeignKey("PeopleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany("People")
.HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("People");
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.Season", b =>
{
b.HasOne("Kyoo.Models.Show", "Show")
.WithMany("Seasons")
.HasForeignKey("ShowID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Show");
});
modelBuilder.Entity("Kyoo.Models.Show", b =>
{
b.HasOne("Kyoo.Models.Studio", "Studio")
.WithMany("Shows")
.HasForeignKey("StudioID");
b.Navigation("Studio");
});
modelBuilder.Entity("Kyoo.Models.Track", b =>
{
b.HasOne("Kyoo.Models.Episode", "Episode")
.WithMany("Tracks")
.HasForeignKey("EpisodeID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Episode");
});
modelBuilder.Entity("LibraryProviderID", b =>
{
b.HasOne("Kyoo.Models.Library", null)
.WithMany()
.HasForeignKey("LibrariesID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.ProviderID", null)
.WithMany()
.HasForeignKey("ProvidersID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LibraryShow", b =>
{
b.HasOne("Kyoo.Models.Library", null)
.WithMany()
.HasForeignKey("LibrariesID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", null)
.WithMany()
.HasForeignKey("ShowsID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Kyoo.Models.Episode", b =>
{
b.Navigation("ExternalIDs");
b.Navigation("Tracks");
});
modelBuilder.Entity("Kyoo.Models.People", b =>
{
b.Navigation("ExternalIDs");
b.Navigation("Roles");
});
modelBuilder.Entity("Kyoo.Models.Season", b =>
{
b.Navigation("Episodes");
b.Navigation("ExternalIDs");
});
modelBuilder.Entity("Kyoo.Models.Show", b =>
{
b.Navigation("Episodes");
b.Navigation("ExternalIDs");
b.Navigation("People");
b.Navigation("Seasons");
});
modelBuilder.Entity("Kyoo.Models.Studio", b =>
{
b.Navigation("Shows");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -122,6 +122,7 @@ namespace Kyoo.Controllers
.GroupBy(Path.GetDirectoryName)
.ToList();
// TODO If the library's path end with a /, the regex is broken.
IEnumerable<string> tasks = shows.Select(x => x.First());
foreach (string[] showTasks in tasks.BatchBy(_parallelTasks))
await Task.WhenAll(showTasks

View File

@ -18,7 +18,7 @@
"ConnectionStrings": {
"Database": "Server=127.0.0.1; Port=5432; Database=kyooDB; User Id=kyoo; Password=kyooPassword; Pooling=true; MaxPoolSize=95; Timeout=30;"
},
"parallelTasks": "40",
"parallelTasks": "1",
"scheduledTasks": {
"scan": "24:00:00"

@ -1 +1 @@
Subproject commit 2d15a6cea98639e286083c96443f56a354ed2002
Subproject commit 3885dca743bbde5d83cb3816646455856fc5c316