diff --git a/back/src/Kyoo.Postgresql/MigrationHelper.cs b/back/src/Kyoo.Postgresql/MigrationHelper.cs
deleted file mode 100644
index f52dd2bd..00000000
--- a/back/src/Kyoo.Postgresql/MigrationHelper.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using Microsoft.EntityFrameworkCore.Migrations;
-
-namespace Kyoo.Postgresql
-{
- public static class MigrationHelper
- {
- public static void CreateLibraryItemsView(MigrationBuilder migrationBuilder)
- {
- // language=PostgreSQL
- migrationBuilder.Sql(@"
- CREATE VIEW library_items AS
- SELECT s.id, s.slug, s.title, s.overview, s.status, s.start_air, s.end_air, s.images, CASE
- WHEN s.is_movie THEN 'movie'::item_type
- ELSE 'show'::item_type
- END AS type
- FROM shows AS s
- WHERE NOT (EXISTS (
- SELECT 1
- FROM link_collection_show AS l
- INNER JOIN collections AS c ON l.collection_id = c.id
- WHERE s.id = l.show_id))
- UNION ALL
- SELECT -c0.id, c0.slug, c0.name AS title, c0.overview, 'unknown'::status AS status,
- NULL AS start_air, NULL AS end_air, c0.images, 'collection'::item_type AS type
- FROM collections AS c0");
- }
-
- public static void DropLibraryItemsView(MigrationBuilder migrationBuilder)
- {
- // language=PostgreSQL
- migrationBuilder.Sql(@"DROP VIEW library_items");
- }
- }
-}
diff --git a/back/src/Kyoo.Postgresql/Migrations/20230806025737_initial.Designer.cs b/back/src/Kyoo.Postgresql/Migrations/20230806025737_initial.Designer.cs
deleted file mode 100644
index 78e47d38..00000000
--- a/back/src/Kyoo.Postgresql/Migrations/20230806025737_initial.Designer.cs
+++ /dev/null
@@ -1,1502 +0,0 @@
-//
-using System;
-using Kyoo.Abstractions.Models;
-using Kyoo.Postgresql;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Infrastructure;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace Kyoo.Postgresql.Migrations
-{
- [DbContext(typeof(PostgresContext))]
- [Migration("20230806025737_initial")]
- partial class Initial
- {
- ///
- protected override void BuildTargetModel(ModelBuilder modelBuilder)
- {
-#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "7.0.9")
- .HasAnnotation("Relational:MaxIdentifierLength", 63);
-
- NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "genre", new[] { "action", "adventure", "animation", "comedy", "crime", "documentary", "drama", "family", "fantasy", "history", "horror", "music", "mystery", "romance", "science_fiction", "thriller", "war", "western" });
- NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "item_kind", new[] { "show", "movie", "collection" });
- NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "status", new[] { "unknown", "finished", "airing", "planned" });
- NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Collection", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("ExternalId")
- .IsRequired()
- .HasColumnType("json")
- .HasColumnName("external_id");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Overview")
- .HasColumnType("text")
- .HasColumnName("overview");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.HasKey("Id")
- .HasName("pk_collections");
-
- b.HasIndex("Slug")
- .IsUnique()
- .HasDatabaseName("ix_collections_slug");
-
- b.ToTable("collections", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Episode", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("AbsoluteNumber")
- .HasColumnType("integer")
- .HasColumnName("absolute_number");
-
- b.Property("EpisodeNumber")
- .HasColumnType("integer")
- .HasColumnName("episode_number");
-
- b.Property("ExternalId")
- .IsRequired()
- .HasColumnType("json")
- .HasColumnName("external_id");
-
- b.Property("Name")
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Overview")
- .HasColumnType("text")
- .HasColumnName("overview");
-
- b.Property("Path")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("path");
-
- b.Property("ReleaseDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("release_date");
-
- b.Property("SeasonID")
- .HasColumnType("integer")
- .HasColumnName("season_id");
-
- b.Property("SeasonNumber")
- .HasColumnType("integer")
- .HasColumnName("season_number");
-
- b.Property("ShowID")
- .HasColumnType("integer")
- .HasColumnName("show_id");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.HasKey("Id")
- .HasName("pk_episodes");
-
- b.HasIndex("SeasonID")
- .HasDatabaseName("ix_episodes_season_id");
-
- b.HasIndex("Slug")
- .IsUnique()
- .HasDatabaseName("ix_episodes_slug");
-
- b.HasIndex("ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber")
- .IsUnique()
- .HasDatabaseName("ix_episodes_show_id_season_number_episode_number_absolute_numb");
-
- b.ToTable("episodes", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.LibraryItem", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("AirDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("air_date");
-
- b.Property("Aliases")
- .IsRequired()
- .HasColumnType("text[]")
- .HasColumnName("aliases");
-
- b.Property("EndAir")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("end_air");
-
- b.Property("ExternalId")
- .IsRequired()
- .HasColumnType("json")
- .HasColumnName("external_id");
-
- b.Property("Genres")
- .IsRequired()
- .HasColumnType("genre[]")
- .HasColumnName("genres");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Overview")
- .HasColumnType("text")
- .HasColumnName("overview");
-
- b.Property("Path")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("path");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.Property("StartAir")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("start_air");
-
- b.Property("Status")
- .HasColumnType("status")
- .HasColumnName("status");
-
- b.Property("Tagline")
- .HasColumnType("text")
- .HasColumnName("tagline");
-
- b.Property("Tags")
- .IsRequired()
- .HasColumnType("text[]")
- .HasColumnName("tags");
-
- b.Property("Trailer")
- .HasColumnType("text")
- .HasColumnName("trailer");
-
- b.HasKey("Id")
- .HasName("pk_library_items");
-
- b.ToTable("library_items", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Movie", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("AirDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("air_date");
-
- b.Property("Aliases")
- .IsRequired()
- .HasColumnType("text[]")
- .HasColumnName("aliases");
-
- b.Property("ExternalId")
- .IsRequired()
- .HasColumnType("json")
- .HasColumnName("external_id");
-
- b.Property("Genres")
- .IsRequired()
- .HasColumnType("genre[]")
- .HasColumnName("genres");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Overview")
- .HasColumnType("text")
- .HasColumnName("overview");
-
- b.Property("Path")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("path");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.Property("Status")
- .HasColumnType("status")
- .HasColumnName("status");
-
- b.Property("StudioID")
- .HasColumnType("integer")
- .HasColumnName("studio_id");
-
- b.Property("Tagline")
- .HasColumnType("text")
- .HasColumnName("tagline");
-
- b.Property("Tags")
- .IsRequired()
- .HasColumnType("text[]")
- .HasColumnName("tags");
-
- b.Property("Trailer")
- .HasColumnType("text")
- .HasColumnName("trailer");
-
- b.HasKey("Id")
- .HasName("pk_movies");
-
- b.HasIndex("Slug")
- .IsUnique()
- .HasDatabaseName("ix_movies_slug");
-
- b.HasIndex("StudioID")
- .HasDatabaseName("ix_movies_studio_id");
-
- b.ToTable("movies", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.People", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("ExternalId")
- .IsRequired()
- .HasColumnType("json")
- .HasColumnName("external_id");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.HasKey("Id")
- .HasName("pk_people");
-
- b.HasIndex("Slug")
- .IsUnique()
- .HasDatabaseName("ix_people_slug");
-
- b.ToTable("people", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.PeopleRole", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("MovieID")
- .HasColumnType("integer")
- .HasColumnName("movie_id");
-
- b.Property("PeopleID")
- .HasColumnType("integer")
- .HasColumnName("people_id");
-
- b.Property("Role")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("role");
-
- b.Property("ShowID")
- .HasColumnType("integer")
- .HasColumnName("show_id");
-
- b.Property("Type")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("type");
-
- b.HasKey("Id")
- .HasName("pk_people_roles");
-
- b.HasIndex("MovieID")
- .HasDatabaseName("ix_people_roles_movie_id");
-
- b.HasIndex("PeopleID")
- .HasDatabaseName("ix_people_roles_people_id");
-
- b.HasIndex("ShowID")
- .HasDatabaseName("ix_people_roles_show_id");
-
- b.ToTable("people_roles", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Season", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("EndDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("end_date");
-
- b.Property("ExternalId")
- .IsRequired()
- .HasColumnType("json")
- .HasColumnName("external_id");
-
- b.Property("Name")
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Overview")
- .HasColumnType("text")
- .HasColumnName("overview");
-
- b.Property("SeasonNumber")
- .HasColumnType("integer")
- .HasColumnName("season_number");
-
- b.Property("ShowID")
- .HasColumnType("integer")
- .HasColumnName("show_id");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.Property("StartDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("start_date");
-
- b.HasKey("Id")
- .HasName("pk_seasons");
-
- b.HasIndex("Slug")
- .IsUnique()
- .HasDatabaseName("ix_seasons_slug");
-
- b.HasIndex("ShowID", "SeasonNumber")
- .IsUnique()
- .HasDatabaseName("ix_seasons_show_id_season_number");
-
- b.ToTable("seasons", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Show", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("Aliases")
- .IsRequired()
- .HasColumnType("text[]")
- .HasColumnName("aliases");
-
- b.Property("EndAir")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("end_air");
-
- b.Property("ExternalId")
- .IsRequired()
- .HasColumnType("json")
- .HasColumnName("external_id");
-
- b.Property("Genres")
- .IsRequired()
- .HasColumnType("genre[]")
- .HasColumnName("genres");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Overview")
- .HasColumnType("text")
- .HasColumnName("overview");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.Property("StartAir")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("start_air");
-
- b.Property("Status")
- .HasColumnType("status")
- .HasColumnName("status");
-
- b.Property("StudioID")
- .HasColumnType("integer")
- .HasColumnName("studio_id");
-
- b.Property("Tagline")
- .HasColumnType("text")
- .HasColumnName("tagline");
-
- b.Property("Tags")
- .IsRequired()
- .HasColumnType("text[]")
- .HasColumnName("tags");
-
- b.Property("Trailer")
- .HasColumnType("text")
- .HasColumnName("trailer");
-
- b.HasKey("Id")
- .HasName("pk_shows");
-
- b.HasIndex("Slug")
- .IsUnique()
- .HasDatabaseName("ix_shows_slug");
-
- b.HasIndex("StudioID")
- .HasDatabaseName("ix_shows_studio_id");
-
- b.ToTable("shows", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Studio", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("ExternalId")
- .IsRequired()
- .HasColumnType("json")
- .HasColumnName("external_id");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.HasKey("Id")
- .HasName("pk_studios");
-
- b.HasIndex("Slug")
- .IsUnique()
- .HasDatabaseName("ix_studios_slug");
-
- b.ToTable("studios", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.User", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("Email")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("email");
-
- b.Property("Password")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("password");
-
- b.Property("Permissions")
- .IsRequired()
- .HasColumnType("text[]")
- .HasColumnName("permissions");
-
- b.Property("Slug")
- .IsRequired()
- .HasMaxLength(256)
- .HasColumnType("character varying(256)")
- .HasColumnName("slug");
-
- b.Property("Username")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("username");
-
- b.HasKey("Id")
- .HasName("pk_users");
-
- b.HasIndex("Slug")
- .IsUnique()
- .HasDatabaseName("ix_users_slug");
-
- b.ToTable("users", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.WatchedEpisode", b =>
- {
- b.Property("UserID")
- .HasColumnType("integer")
- .HasColumnName("user_id");
-
- b.Property("EpisodeID")
- .HasColumnType("integer")
- .HasColumnName("episode_id");
-
- b.Property("WatchedPercentage")
- .HasColumnType("integer")
- .HasColumnName("watched_percentage");
-
- b.HasKey("UserID", "EpisodeID")
- .HasName("pk_watched_episode");
-
- b.HasIndex("EpisodeID")
- .HasDatabaseName("ix_watched_episode_episode_id");
-
- b.ToTable("watched_episode", (string)null);
- });
-
- modelBuilder.Entity("ShowUser", b =>
- {
- b.Property("UsersId")
- .HasColumnType("integer")
- .HasColumnName("users_id");
-
- b.Property("WatchedId")
- .HasColumnType("integer")
- .HasColumnName("watched_id");
-
- b.HasKey("UsersId", "WatchedId")
- .HasName("pk_link_user_show");
-
- b.HasIndex("WatchedId")
- .HasDatabaseName("ix_link_user_show_watched_id");
-
- b.ToTable("link_user_show", (string)null);
- });
-
- modelBuilder.Entity("link_collection_movie", b =>
- {
- b.Property("collection_id")
- .HasColumnType("integer")
- .HasColumnName("collection_id");
-
- b.Property("movie_id")
- .HasColumnType("integer")
- .HasColumnName("movie_id");
-
- b.HasKey("collection_id", "movie_id")
- .HasName("pk_link_collection_movie");
-
- b.HasIndex("movie_id")
- .HasDatabaseName("ix_link_collection_movie_movie_id");
-
- b.ToTable("link_collection_movie", (string)null);
- });
-
- modelBuilder.Entity("link_collection_show", b =>
- {
- b.Property("collection_id")
- .HasColumnType("integer")
- .HasColumnName("collection_id");
-
- b.Property("show_id")
- .HasColumnType("integer")
- .HasColumnName("show_id");
-
- b.HasKey("collection_id", "show_id")
- .HasName("pk_link_collection_show");
-
- b.HasIndex("show_id")
- .HasDatabaseName("ix_link_collection_show_show_id");
-
- b.ToTable("link_collection_show", (string)null);
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Collection", b =>
- {
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
- {
- b1.Property("CollectionId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("logo_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("logo_source");
-
- b1.HasKey("CollectionId");
-
- b1.ToTable("collections");
-
- b1.WithOwner()
- .HasForeignKey("CollectionId")
- .HasConstraintName("fk_collections_collections_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
- {
- b1.Property("CollectionId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("poster_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("poster_source");
-
- b1.HasKey("CollectionId");
-
- b1.ToTable("collections");
-
- b1.WithOwner()
- .HasForeignKey("CollectionId")
- .HasConstraintName("fk_collections_collections_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
- {
- b1.Property("CollectionId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("thumbnail_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("thumbnail_source");
-
- b1.HasKey("CollectionId");
-
- b1.ToTable("collections");
-
- b1.WithOwner()
- .HasForeignKey("CollectionId")
- .HasConstraintName("fk_collections_collections_id");
- });
-
- b.Navigation("Logo");
-
- b.Navigation("Poster");
-
- b.Navigation("Thumbnail");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Episode", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.Season", "Season")
- .WithMany("Episodes")
- .HasForeignKey("SeasonID")
- .OnDelete(DeleteBehavior.Cascade)
- .HasConstraintName("fk_episodes_seasons_season_id");
-
- b.HasOne("Kyoo.Abstractions.Models.Show", "Show")
- .WithMany("Episodes")
- .HasForeignKey("ShowID")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_episodes_shows_show_id");
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
- {
- b1.Property("EpisodeId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("logo_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("logo_source");
-
- b1.HasKey("EpisodeId");
-
- b1.ToTable("episodes");
-
- b1.WithOwner()
- .HasForeignKey("EpisodeId")
- .HasConstraintName("fk_episodes_episodes_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
- {
- b1.Property("EpisodeId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("poster_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("poster_source");
-
- b1.HasKey("EpisodeId");
-
- b1.ToTable("episodes");
-
- b1.WithOwner()
- .HasForeignKey("EpisodeId")
- .HasConstraintName("fk_episodes_episodes_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
- {
- b1.Property("EpisodeId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("thumbnail_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("thumbnail_source");
-
- b1.HasKey("EpisodeId");
-
- b1.ToTable("episodes");
-
- b1.WithOwner()
- .HasForeignKey("EpisodeId")
- .HasConstraintName("fk_episodes_episodes_id");
- });
-
- b.Navigation("Logo");
-
- b.Navigation("Poster");
-
- b.Navigation("Season");
-
- b.Navigation("Show");
-
- b.Navigation("Thumbnail");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.LibraryItem", b =>
- {
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
- {
- b1.Property("LibraryItemId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("logo_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("logo_source");
-
- b1.HasKey("LibraryItemId");
-
- b1.ToTable("library_items");
-
- b1.WithOwner()
- .HasForeignKey("LibraryItemId")
- .HasConstraintName("fk_library_items_library_items_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
- {
- b1.Property("LibraryItemId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("poster_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("poster_source");
-
- b1.HasKey("LibraryItemId");
-
- b1.ToTable("library_items");
-
- b1.WithOwner()
- .HasForeignKey("LibraryItemId")
- .HasConstraintName("fk_library_items_library_items_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
- {
- b1.Property("LibraryItemId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("thumbnail_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("thumbnail_source");
-
- b1.HasKey("LibraryItemId");
-
- b1.ToTable("library_items");
-
- b1.WithOwner()
- .HasForeignKey("LibraryItemId")
- .HasConstraintName("fk_library_items_library_items_id");
- });
-
- b.Navigation("Logo");
-
- b.Navigation("Poster");
-
- b.Navigation("Thumbnail");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Movie", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.Studio", "Studio")
- .WithMany("Movies")
- .HasForeignKey("StudioID")
- .OnDelete(DeleteBehavior.SetNull)
- .HasConstraintName("fk_movies_studios_studio_id");
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
- {
- b1.Property("MovieId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("logo_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("logo_source");
-
- b1.HasKey("MovieId");
-
- b1.ToTable("movies");
-
- b1.WithOwner()
- .HasForeignKey("MovieId")
- .HasConstraintName("fk_movies_movies_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
- {
- b1.Property("MovieId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("poster_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("poster_source");
-
- b1.HasKey("MovieId");
-
- b1.ToTable("movies");
-
- b1.WithOwner()
- .HasForeignKey("MovieId")
- .HasConstraintName("fk_movies_movies_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
- {
- b1.Property("MovieId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("thumbnail_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("thumbnail_source");
-
- b1.HasKey("MovieId");
-
- b1.ToTable("movies");
-
- b1.WithOwner()
- .HasForeignKey("MovieId")
- .HasConstraintName("fk_movies_movies_id");
- });
-
- b.Navigation("Logo");
-
- b.Navigation("Poster");
-
- b.Navigation("Studio");
-
- b.Navigation("Thumbnail");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.People", b =>
- {
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
- {
- b1.Property("PeopleId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("logo_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("logo_source");
-
- b1.HasKey("PeopleId");
-
- b1.ToTable("people");
-
- b1.WithOwner()
- .HasForeignKey("PeopleId")
- .HasConstraintName("fk_people_people_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
- {
- b1.Property("PeopleId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("poster_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("poster_source");
-
- b1.HasKey("PeopleId");
-
- b1.ToTable("people");
-
- b1.WithOwner()
- .HasForeignKey("PeopleId")
- .HasConstraintName("fk_people_people_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
- {
- b1.Property("PeopleId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("thumbnail_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("thumbnail_source");
-
- b1.HasKey("PeopleId");
-
- b1.ToTable("people");
-
- b1.WithOwner()
- .HasForeignKey("PeopleId")
- .HasConstraintName("fk_people_people_id");
- });
-
- b.Navigation("Logo");
-
- b.Navigation("Poster");
-
- b.Navigation("Thumbnail");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.PeopleRole", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.Movie", "Movie")
- .WithMany("People")
- .HasForeignKey("MovieID")
- .HasConstraintName("fk_people_roles_movies_movie_id");
-
- b.HasOne("Kyoo.Abstractions.Models.People", "People")
- .WithMany("Roles")
- .HasForeignKey("PeopleID")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_people_roles_people_people_id");
-
- b.HasOne("Kyoo.Abstractions.Models.Show", "Show")
- .WithMany("People")
- .HasForeignKey("ShowID")
- .HasConstraintName("fk_people_roles_shows_show_id");
-
- b.Navigation("Movie");
-
- b.Navigation("People");
-
- b.Navigation("Show");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Season", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.Show", "Show")
- .WithMany("Seasons")
- .HasForeignKey("ShowID")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_seasons_shows_show_id");
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
- {
- b1.Property("SeasonId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("logo_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("logo_source");
-
- b1.HasKey("SeasonId");
-
- b1.ToTable("seasons");
-
- b1.WithOwner()
- .HasForeignKey("SeasonId")
- .HasConstraintName("fk_seasons_seasons_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
- {
- b1.Property("SeasonId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("poster_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("poster_source");
-
- b1.HasKey("SeasonId");
-
- b1.ToTable("seasons");
-
- b1.WithOwner()
- .HasForeignKey("SeasonId")
- .HasConstraintName("fk_seasons_seasons_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
- {
- b1.Property("SeasonId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("thumbnail_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("thumbnail_source");
-
- b1.HasKey("SeasonId");
-
- b1.ToTable("seasons");
-
- b1.WithOwner()
- .HasForeignKey("SeasonId")
- .HasConstraintName("fk_seasons_seasons_id");
- });
-
- b.Navigation("Logo");
-
- b.Navigation("Poster");
-
- b.Navigation("Show");
-
- b.Navigation("Thumbnail");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Show", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.Studio", "Studio")
- .WithMany("Shows")
- .HasForeignKey("StudioID")
- .OnDelete(DeleteBehavior.SetNull)
- .HasConstraintName("fk_shows_studios_studio_id");
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
- {
- b1.Property("ShowId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("logo_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("logo_source");
-
- b1.HasKey("ShowId");
-
- b1.ToTable("shows");
-
- b1.WithOwner()
- .HasForeignKey("ShowId")
- .HasConstraintName("fk_shows_shows_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Poster", b1 =>
- {
- b1.Property("ShowId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("poster_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("poster_source");
-
- b1.HasKey("ShowId");
-
- b1.ToTable("shows");
-
- b1.WithOwner()
- .HasForeignKey("ShowId")
- .HasConstraintName("fk_shows_shows_id");
- });
-
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Thumbnail", b1 =>
- {
- b1.Property("ShowId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("thumbnail_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("thumbnail_source");
-
- b1.HasKey("ShowId");
-
- b1.ToTable("shows");
-
- b1.WithOwner()
- .HasForeignKey("ShowId")
- .HasConstraintName("fk_shows_shows_id");
- });
-
- b.Navigation("Logo");
-
- b.Navigation("Poster");
-
- b.Navigation("Studio");
-
- b.Navigation("Thumbnail");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.User", b =>
- {
- b.OwnsOne("Kyoo.Abstractions.Models.Image", "Logo", b1 =>
- {
- b1.Property("UserId")
- .HasColumnType("integer")
- .HasColumnName("id");
-
- b1.Property("Blurhash")
- .IsRequired()
- .HasMaxLength(32)
- .HasColumnType("character varying(32)")
- .HasColumnName("logo_blurhash");
-
- b1.Property("Source")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("logo_source");
-
- b1.HasKey("UserId");
-
- b1.ToTable("users");
-
- b1.WithOwner()
- .HasForeignKey("UserId")
- .HasConstraintName("fk_users_users_id");
- });
-
- b.Navigation("Logo");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.WatchedEpisode", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.Episode", "Episode")
- .WithMany()
- .HasForeignKey("EpisodeID")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_watched_episode_episodes_episode_id");
-
- b.HasOne("Kyoo.Abstractions.Models.User", null)
- .WithMany("CurrentlyWatching")
- .HasForeignKey("UserID")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_watched_episode_users_user_id");
-
- b.Navigation("Episode");
- });
-
- modelBuilder.Entity("ShowUser", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.User", null)
- .WithMany()
- .HasForeignKey("UsersId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_link_user_show_users_users_id");
-
- b.HasOne("Kyoo.Abstractions.Models.Show", null)
- .WithMany()
- .HasForeignKey("WatchedId")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_link_user_show_shows_watched_id");
- });
-
- modelBuilder.Entity("link_collection_movie", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.Collection", null)
- .WithMany()
- .HasForeignKey("collection_id")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_link_collection_movie_collections_collection_id");
-
- b.HasOne("Kyoo.Abstractions.Models.Movie", null)
- .WithMany()
- .HasForeignKey("movie_id")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_link_collection_movie_movies_movie_id");
- });
-
- modelBuilder.Entity("link_collection_show", b =>
- {
- b.HasOne("Kyoo.Abstractions.Models.Collection", null)
- .WithMany()
- .HasForeignKey("collection_id")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_link_collection_show_collections_collection_id");
-
- b.HasOne("Kyoo.Abstractions.Models.Show", null)
- .WithMany()
- .HasForeignKey("show_id")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired()
- .HasConstraintName("fk_link_collection_show_shows_show_id");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Movie", b =>
- {
- b.Navigation("People");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.People", b =>
- {
- b.Navigation("Roles");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Season", b =>
- {
- b.Navigation("Episodes");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Show", b =>
- {
- b.Navigation("Episodes");
-
- b.Navigation("People");
-
- b.Navigation("Seasons");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.Studio", b =>
- {
- b.Navigation("Movies");
-
- b.Navigation("Shows");
- });
-
- modelBuilder.Entity("Kyoo.Abstractions.Models.User", b =>
- {
- b.Navigation("CurrentlyWatching");
- });
-#pragma warning restore 612, 618
- }
- }
-}
diff --git a/back/src/Kyoo.Postgresql/Migrations/20230806025737_initial.cs b/back/src/Kyoo.Postgresql/Migrations/20230806025737_initial.cs
deleted file mode 100644
index 2cf9c227..00000000
--- a/back/src/Kyoo.Postgresql/Migrations/20230806025737_initial.cs
+++ /dev/null
@@ -1,547 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using Kyoo.Abstractions.Models;
-using Microsoft.EntityFrameworkCore.Migrations;
-using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
-#nullable disable
-
-namespace Kyoo.Postgresql.Migrations
-{
- ///
- public partial class Initial : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterDatabase()
- .Annotation("Npgsql:Enum:genre", "action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western")
- .Annotation("Npgsql:Enum:item_kind", "show,movie,collection")
- .Annotation("Npgsql:Enum:status", "unknown,finished,airing,planned");
-
- migrationBuilder.CreateTable(
- name: "collections",
- columns: table => new
- {
- id = table.Column(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- slug = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
- name = table.Column(type: "text", nullable: false),
- overview = table.Column(type: "text", nullable: true),
- poster_source = table.Column(type: "text", nullable: true),
- poster_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- thumbnail_source = table.Column(type: "text", nullable: true),
- thumbnail_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- logo_source = table.Column(type: "text", nullable: true),
- logo_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- external_id = table.Column(type: "json", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_collections", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "people",
- columns: table => new
- {
- id = table.Column(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- slug = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
- name = table.Column(type: "text", nullable: false),
- poster_source = table.Column(type: "text", nullable: true),
- poster_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- thumbnail_source = table.Column(type: "text", nullable: true),
- thumbnail_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- logo_source = table.Column(type: "text", nullable: true),
- logo_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- external_id = table.Column(type: "json", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_people", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "studios",
- columns: table => new
- {
- id = table.Column(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- slug = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
- name = table.Column(type: "text", nullable: false),
- external_id = table.Column(type: "json", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_studios", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "users",
- columns: table => new
- {
- id = table.Column(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- slug = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
- username = table.Column(type: "text", nullable: false),
- email = table.Column(type: "text", nullable: false),
- password = table.Column(type: "text", nullable: false),
- permissions = table.Column(type: "text[]", nullable: false),
- logo_source = table.Column(type: "text", nullable: true),
- logo_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_users", x => x.id);
- });
-
- migrationBuilder.CreateTable(
- name: "movies",
- columns: table => new
- {
- id = table.Column(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- slug = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
- name = table.Column(type: "text", nullable: false),
- tagline = table.Column(type: "text", nullable: true),
- aliases = table.Column(type: "text[]", nullable: false),
- path = table.Column(type: "text", nullable: false),
- overview = table.Column(type: "text", nullable: true),
- tags = table.Column(type: "text[]", nullable: false),
- genres = table.Column(type: "genre[]", nullable: false),
- status = table.Column(type: "status", nullable: false),
- air_date = table.Column(type: "timestamp with time zone", nullable: true),
- poster_source = table.Column(type: "text", nullable: true),
- poster_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- thumbnail_source = table.Column(type: "text", nullable: true),
- thumbnail_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- logo_source = table.Column(type: "text", nullable: true),
- logo_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- trailer = table.Column(type: "text", nullable: true),
- external_id = table.Column(type: "json", nullable: false),
- studio_id = table.Column(type: "integer", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_movies", x => x.id);
- table.ForeignKey(
- name: "fk_movies_studios_studio_id",
- column: x => x.studio_id,
- principalTable: "studios",
- principalColumn: "id",
- onDelete: ReferentialAction.SetNull);
- });
-
- migrationBuilder.CreateTable(
- name: "shows",
- columns: table => new
- {
- id = table.Column(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- slug = table.Column(type: "character varying(256)", maxLength: 256, nullable: false),
- name = table.Column(type: "text", nullable: false),
- tagline = table.Column(type: "text", nullable: true),
- aliases = table.Column(type: "text[]", nullable: false),
- overview = table.Column(type: "text", nullable: true),
- tags = table.Column(type: "text[]", nullable: false),
- genres = table.Column(type: "genre[]", nullable: false),
- status = table.Column(type: "status", nullable: false),
- start_air = table.Column(type: "timestamp with time zone", nullable: true),
- end_air = table.Column(type: "timestamp with time zone", nullable: true),
- poster_source = table.Column(type: "text", nullable: true),
- poster_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- thumbnail_source = table.Column(type: "text", nullable: true),
- thumbnail_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- logo_source = table.Column(type: "text", nullable: true),
- logo_blurhash = table.Column(type: "character varying(32)", maxLength: 32, nullable: true),
- trailer = table.Column(type: "text", nullable: true),
- external_id = table.Column(type: "json", nullable: false),
- studio_id = table.Column(type: "integer", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_shows", x => x.id);
- table.ForeignKey(
- name: "fk_shows_studios_studio_id",
- column: x => x.studio_id,
- principalTable: "studios",
- principalColumn: "id",
- onDelete: ReferentialAction.SetNull);
- });
-
- migrationBuilder.CreateTable(
- name: "link_collection_movie",
- columns: table => new
- {
- collection_id = table.Column(type: "integer", nullable: false),
- movie_id = table.Column(type: "integer", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_link_collection_movie", x => new { x.collection_id, x.movie_id });
- table.ForeignKey(
- name: "fk_link_collection_movie_collections_collection_id",
- column: x => x.collection_id,
- principalTable: "collections",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "fk_link_collection_movie_movies_movie_id",
- column: x => x.movie_id,
- principalTable: "movies",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "link_collection_show",
- columns: table => new
- {
- collection_id = table.Column(type: "integer", nullable: false),
- show_id = table.Column(type: "integer", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_link_collection_show", x => new { x.collection_id, x.show_id });
- table.ForeignKey(
- name: "fk_link_collection_show_collections_collection_id",
- column: x => x.collection_id,
- principalTable: "collections",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "fk_link_collection_show_shows_show_id",
- column: x => x.show_id,
- principalTable: "shows",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "link_user_show",
- columns: table => new
- {
- users_id = table.Column(type: "integer", nullable: false),
- watched_id = table.Column(type: "integer", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("pk_link_user_show", x => new { x.users_id, x.watched_id });
- table.ForeignKey(
- name: "fk_link_user_show_shows_watched_id",
- column: x => x.watched_id,
- principalTable: "shows",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "fk_link_user_show_users_users_id",
- column: x => x.users_id,
- principalTable: "users",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "people_roles",
- columns: table => new
- {
- id = table.Column(type: "integer", nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
- people_id = table.Column