Fix timestamps format

This commit is contained in:
Zoe Roux 2023-07-26 22:25:55 +09:00
parent 95ccceb259
commit 83b8627717
10 changed files with 1635 additions and 168 deletions

View File

@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "7.0.7",
"version": "7.0.9",
"commands": [
"dotnet-ef"
]

View File

@ -37,5 +37,6 @@
<Rule Id="SA1643" Action="None" /> <!-- DestructorSummaryDocumentationMustBeginWithStandardText -->
<Rule Id="SA1623" Action="None" /> <!-- PropertySummaryDocumentationMustMatchAccessors -->
<Rule Id="SA1629" Action="None" /> <!-- DocumentationTextMustEndWithAPeriod -->
<Rule Id="SA1600" Action="None" /> <!-- Elements Shuld be Documented -->
</Rules>
</RuleSet>

View File

@ -353,6 +353,9 @@ namespace Kyoo.Postgresql
modelBuilder.Entity<User>()
.HasIndex(x => x.Slug)
.IsUnique();
modelBuilder.Entity<LibraryItem>()
.ToView("library_items");
}
/// <summary>

View File

@ -0,0 +1,52 @@
// 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 <https://www.gnu.org/licenses/>.
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");
}
}
}

View File

@ -157,23 +157,7 @@ namespace Kyoo.Postgresql.Migrations
BEFORE INSERT OR UPDATE OF episode_id, is_forced, language, track_index, type ON tracks
FOR EACH ROW EXECUTE PROCEDURE track_slug_update();");
// 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");
MigrationHelper.CreateLibraryItemsView(migrationBuilder);
}
/// <inheritdoc/>
@ -199,8 +183,7 @@ namespace Kyoo.Postgresql.Migrations
migrationBuilder.Sql("DROP TRIGGER episode_track_slug_trigger ON episodes;");
// language=PostgreSQL
migrationBuilder.Sql(@"DROP FUNCTION episode_update_tracks_slug;");
// language=PostgreSQL
migrationBuilder.Sql(@"DROP VIEW library_items;");
MigrationHelper.DropLibraryItemsView(migrationBuilder);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,135 @@
// 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 <https://www.gnu.org/licenses/>.
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kyoo.Postgresql.Migrations
{
/// <inheritdoc />
public partial class Timestamp : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
MigrationHelper.DropLibraryItemsView(migrationBuilder);
migrationBuilder.AlterColumn<DateTime>(
name: "start_air",
table: "shows",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "end_air",
table: "shows",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "start_date",
table: "seasons",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "end_date",
table: "seasons",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "release_date",
table: "episodes",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
MigrationHelper.CreateLibraryItemsView(migrationBuilder);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
MigrationHelper.DropLibraryItemsView(migrationBuilder);
migrationBuilder.AlterColumn<DateTime>(
name: "start_air",
table: "shows",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "end_air",
table: "shows",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "start_date",
table: "seasons",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "end_date",
table: "seasons",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "release_date",
table: "episodes",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
MigrationHelper.CreateLibraryItemsView(migrationBuilder);
}
}
}

View File

@ -8,6 +8,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Kyoo.Postgresql.Migrations
{
[DbContext(typeof(PostgresContext))]
@ -17,20 +19,22 @@ namespace Kyoo.Postgresql.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasPostgresEnum(null, "item_type", new[] { "show", "movie", "collection" })
.HasPostgresEnum(null, "status", new[] { "unknown", "finished", "airing", "planned" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle" })
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.7")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "item_type", new[] { "show", "movie", "collection" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "status", new[] { "unknown", "finished", "airing", "planned" });
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "stream_type", new[] { "unknown", "video", "audio", "subtitle" });
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Kyoo.Abstractions.Models.Collection", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<Dictionary<int, string>>("Images")
.HasColumnType("jsonb")
@ -56,7 +60,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_collections_slug");
b.ToTable("collections");
b.ToTable("collections", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Episode", b =>
@ -64,8 +68,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<int?>("AbsoluteNumber")
.HasColumnType("integer")
@ -88,7 +93,7 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("path");
b.Property<DateTime?>("ReleaseDate")
.HasColumnType("timestamp without time zone")
.HasColumnType("timestamp with time zone")
.HasColumnName("release_date");
b.Property<int?>("SeasonID")
@ -126,7 +131,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_episodes_show_id_season_number_episode_number_absolute_numb");
b.ToTable("episodes");
b.ToTable("episodes", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Genre", b =>
@ -134,8 +139,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<string>("Name")
.HasColumnType("text")
@ -153,7 +159,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_genres_slug");
b.ToTable("genres");
b.ToTable("genres", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Library", b =>
@ -161,8 +167,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<string>("Name")
.HasColumnType("text")
@ -184,18 +191,17 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_libraries_slug");
b.ToTable("libraries");
b.ToTable("libraries", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.LibraryItem", b =>
{
b.Property<int>("ID")
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
b.Property<DateTime?>("EndAir")
.HasColumnType("timestamp without time zone")
.HasColumnType("timestamp with time zone")
.HasColumnName("end_air");
b.Property<Dictionary<int, string>>("Images")
@ -211,7 +217,7 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("slug");
b.Property<DateTime?>("StartAir")
.HasColumnType("timestamp without time zone")
.HasColumnType("timestamp with time zone")
.HasColumnName("start_air");
b.Property<Status?>("Status")
@ -229,7 +235,9 @@ namespace Kyoo.Postgresql.Migrations
b.HasKey("ID")
.HasName("pk_library_items");
b.ToView("library_items");
b.ToTable((string)null);
b.ToView("library_items", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.People", b =>
@ -237,8 +245,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<Dictionary<int, string>>("Images")
.HasColumnType("jsonb")
@ -260,7 +269,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_people_slug");
b.ToTable("people");
b.ToTable("people", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.PeopleRole", b =>
@ -268,8 +277,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<int>("PeopleID")
.HasColumnType("integer")
@ -296,7 +306,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("ShowID")
.HasDatabaseName("ix_people_roles_show_id");
b.ToTable("people_roles");
b.ToTable("people_roles", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Provider", b =>
@ -304,8 +314,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<Dictionary<int, string>>("Images")
.HasColumnType("jsonb")
@ -327,7 +338,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_providers_slug");
b.ToTable("providers");
b.ToTable("providers", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Season", b =>
@ -335,11 +346,12 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<DateTime?>("EndDate")
.HasColumnType("timestamp without time zone")
.HasColumnType("timestamp with time zone")
.HasColumnName("end_date");
b.Property<Dictionary<int, string>>("Images")
@ -364,7 +376,7 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("slug");
b.Property<DateTime?>("StartDate")
.HasColumnType("timestamp without time zone")
.HasColumnType("timestamp with time zone")
.HasColumnName("start_date");
b.Property<string>("Title")
@ -382,7 +394,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_seasons_show_id_season_number");
b.ToTable("seasons");
b.ToTable("seasons", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Show", b =>
@ -390,15 +402,16 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<string[]>("Aliases")
.HasColumnType("text[]")
.HasColumnName("aliases");
b.Property<DateTime?>("EndAir")
.HasColumnType("timestamp without time zone")
.HasColumnType("timestamp with time zone")
.HasColumnName("end_air");
b.Property<Dictionary<int, string>>("Images")
@ -423,7 +436,7 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("slug");
b.Property<DateTime?>("StartAir")
.HasColumnType("timestamp without time zone")
.HasColumnType("timestamp with time zone")
.HasColumnName("start_air");
b.Property<Status>("Status")
@ -448,7 +461,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("StudioID")
.HasDatabaseName("ix_shows_studio_id");
b.ToTable("shows");
b.ToTable("shows", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Studio", b =>
@ -456,8 +469,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<string>("Name")
.HasColumnType("text")
@ -475,7 +489,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_studios_slug");
b.ToTable("studios");
b.ToTable("studios", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Track", b =>
@ -483,8 +497,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<string>("Codec")
.HasColumnType("text")
@ -542,7 +557,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_tracks_episode_id_type_language_track_index_is_forced");
b.ToTable("tracks");
b.ToTable("tracks", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.User", b =>
@ -550,8 +565,9 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ID"));
b.Property<string>("Email")
.HasColumnType("text")
@ -589,7 +605,7 @@ namespace Kyoo.Postgresql.Migrations
.IsUnique()
.HasDatabaseName("ix_users_slug");
b.ToTable("users");
b.ToTable("users", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.WatchedEpisode", b =>
@ -612,7 +628,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("EpisodeID")
.HasDatabaseName("ix_watched_episodes_episode_id");
b.ToTable("watched_episodes");
b.ToTable("watched_episodes", (string)null);
});
modelBuilder.Entity("ShowUser", b =>
@ -631,7 +647,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("WatchedID")
.HasDatabaseName("ix_link_user_show_watched_id");
b.ToTable("link_user_show");
b.ToTable("link_user_show", (string)null);
});
modelBuilder.Entity("collection_metadata_id", b =>
@ -658,7 +674,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("ProviderID")
.HasDatabaseName("ix_collection_metadata_id_provider_id");
b.ToTable("collection_metadata_id");
b.ToTable("collection_metadata_id", (string)null);
});
modelBuilder.Entity("episode_metadata_id", b =>
@ -685,7 +701,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("ProviderID")
.HasDatabaseName("ix_episode_metadata_id_provider_id");
b.ToTable("episode_metadata_id");
b.ToTable("episode_metadata_id", (string)null);
});
modelBuilder.Entity("link_collection_show", b =>
@ -704,7 +720,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("show_id")
.HasDatabaseName("ix_link_collection_show_show_id");
b.ToTable("link_collection_show");
b.ToTable("link_collection_show", (string)null);
});
modelBuilder.Entity("link_library_collection", b =>
@ -723,7 +739,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("library_id")
.HasDatabaseName("ix_link_library_collection_library_id");
b.ToTable("link_library_collection");
b.ToTable("link_library_collection", (string)null);
});
modelBuilder.Entity("link_library_provider", b =>
@ -742,7 +758,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("provider_id")
.HasDatabaseName("ix_link_library_provider_provider_id");
b.ToTable("link_library_provider");
b.ToTable("link_library_provider", (string)null);
});
modelBuilder.Entity("link_library_show", b =>
@ -761,7 +777,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("show_id")
.HasDatabaseName("ix_link_library_show_show_id");
b.ToTable("link_library_show");
b.ToTable("link_library_show", (string)null);
});
modelBuilder.Entity("link_show_genre", b =>
@ -780,7 +796,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("show_id")
.HasDatabaseName("ix_link_show_genre_show_id");
b.ToTable("link_show_genre");
b.ToTable("link_show_genre", (string)null);
});
modelBuilder.Entity("people_metadata_id", b =>
@ -807,7 +823,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("ProviderID")
.HasDatabaseName("ix_people_metadata_id_provider_id");
b.ToTable("people_metadata_id");
b.ToTable("people_metadata_id", (string)null);
});
modelBuilder.Entity("season_metadata_id", b =>
@ -834,7 +850,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("ProviderID")
.HasDatabaseName("ix_season_metadata_id_provider_id");
b.ToTable("season_metadata_id");
b.ToTable("season_metadata_id", (string)null);
});
modelBuilder.Entity("show_metadata_id", b =>
@ -861,7 +877,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("ProviderID")
.HasDatabaseName("ix_show_metadata_id_provider_id");
b.ToTable("show_metadata_id");
b.ToTable("show_metadata_id", (string)null);
});
modelBuilder.Entity("studio_metadata_id", b =>
@ -888,7 +904,7 @@ namespace Kyoo.Postgresql.Migrations
b.HasIndex("ProviderID")
.HasDatabaseName("ix_studio_metadata_id_provider_id");
b.ToTable("studio_metadata_id");
b.ToTable("studio_metadata_id", (string)null);
});
modelBuilder.Entity("Kyoo.Abstractions.Models.Episode", b =>
@ -896,15 +912,15 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Season", "Season")
.WithMany("Episodes")
.HasForeignKey("SeasonID")
.HasConstraintName("fk_episodes_seasons_season_id")
.OnDelete(DeleteBehavior.Cascade);
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("fk_episodes_seasons_season_id");
b.HasOne("Kyoo.Abstractions.Models.Show", "Show")
.WithMany("Episodes")
.HasForeignKey("ShowID")
.HasConstraintName("fk_episodes_shows_show_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_episodes_shows_show_id");
b.Navigation("Season");
@ -916,16 +932,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.People", "People")
.WithMany("Roles")
.HasForeignKey("PeopleID")
.HasConstraintName("fk_people_roles_people_people_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.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")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_people_roles_shows_show_id");
b.Navigation("People");
@ -937,9 +953,9 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Show", "Show")
.WithMany("Seasons")
.HasForeignKey("ShowID")
.HasConstraintName("fk_seasons_shows_show_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_seasons_shows_show_id");
b.Navigation("Show");
});
@ -949,8 +965,8 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Studio", "Studio")
.WithMany("Shows")
.HasForeignKey("StudioID")
.HasConstraintName("fk_shows_studios_studio_id")
.OnDelete(DeleteBehavior.SetNull);
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("fk_shows_studios_studio_id");
b.Navigation("Studio");
});
@ -960,9 +976,9 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Episode", "Episode")
.WithMany("Tracks")
.HasForeignKey("EpisodeID")
.HasConstraintName("fk_tracks_episodes_episode_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_tracks_episodes_episode_id");
b.Navigation("Episode");
});
@ -972,16 +988,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Episode", "Episode")
.WithMany()
.HasForeignKey("EpisodeID")
.HasConstraintName("fk_watched_episodes_episodes_episode_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_watched_episodes_episodes_episode_id");
b.HasOne("Kyoo.Abstractions.Models.User", null)
.WithMany("CurrentlyWatching")
.HasForeignKey("UserID")
.HasConstraintName("fk_watched_episodes_users_user_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_watched_episodes_users_user_id");
b.Navigation("Episode");
});
@ -991,16 +1007,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.User", null)
.WithMany()
.HasForeignKey("UsersID")
.HasConstraintName("fk_link_user_show_users_users_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_user_show_users_users_id");
b.HasOne("Kyoo.Abstractions.Models.Show", null)
.WithMany()
.HasForeignKey("WatchedID")
.HasConstraintName("fk_link_user_show_shows_watched_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_user_show_shows_watched_id");
});
modelBuilder.Entity("collection_metadata_id", b =>
@ -1008,16 +1024,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderID")
.HasConstraintName("fk_collection_metadata_id_providers_provider_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_collection_metadata_id_providers_provider_id");
b.HasOne("Kyoo.Abstractions.Models.Collection", null)
.WithMany("ExternalIDs")
.HasForeignKey("ResourceID")
.HasConstraintName("fk_collection_metadata_id_collections_collection_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_collection_metadata_id_collections_collection_id");
b.Navigation("Provider");
});
@ -1027,16 +1043,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderID")
.HasConstraintName("fk_episode_metadata_id_providers_provider_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_episode_metadata_id_providers_provider_id");
b.HasOne("Kyoo.Abstractions.Models.Episode", null)
.WithMany("ExternalIDs")
.HasForeignKey("ResourceID")
.HasConstraintName("fk_episode_metadata_id_episodes_episode_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_episode_metadata_id_episodes_episode_id");
b.Navigation("Provider");
});
@ -1046,16 +1062,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Collection", null)
.WithMany()
.HasForeignKey("collection_id")
.HasConstraintName("fk_link_collection_show_collections_collection_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_collection_show_collections_collection_id");
b.HasOne("Kyoo.Abstractions.Models.Show", null)
.WithMany()
.HasForeignKey("show_id")
.HasConstraintName("fk_link_collection_show_shows_show_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_collection_show_shows_show_id");
});
modelBuilder.Entity("link_library_collection", b =>
@ -1063,16 +1079,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Collection", null)
.WithMany()
.HasForeignKey("collection_id")
.HasConstraintName("fk_link_library_collection_collections_collection_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_library_collection_collections_collection_id");
b.HasOne("Kyoo.Abstractions.Models.Library", null)
.WithMany()
.HasForeignKey("library_id")
.HasConstraintName("fk_link_library_collection_libraries_library_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_library_collection_libraries_library_id");
});
modelBuilder.Entity("link_library_provider", b =>
@ -1080,16 +1096,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Library", null)
.WithMany()
.HasForeignKey("library_id")
.HasConstraintName("fk_link_library_provider_libraries_library_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_library_provider_libraries_library_id");
b.HasOne("Kyoo.Abstractions.Models.Provider", null)
.WithMany()
.HasForeignKey("provider_id")
.HasConstraintName("fk_link_library_provider_providers_provider_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_library_provider_providers_provider_id");
});
modelBuilder.Entity("link_library_show", b =>
@ -1097,16 +1113,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Library", null)
.WithMany()
.HasForeignKey("library_id")
.HasConstraintName("fk_link_library_show_libraries_library_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_library_show_libraries_library_id");
b.HasOne("Kyoo.Abstractions.Models.Show", null)
.WithMany()
.HasForeignKey("show_id")
.HasConstraintName("fk_link_library_show_shows_show_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_library_show_shows_show_id");
});
modelBuilder.Entity("link_show_genre", b =>
@ -1114,16 +1130,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Genre", null)
.WithMany()
.HasForeignKey("genre_id")
.HasConstraintName("fk_link_show_genre_genres_genre_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_show_genre_genres_genre_id");
b.HasOne("Kyoo.Abstractions.Models.Show", null)
.WithMany()
.HasForeignKey("show_id")
.HasConstraintName("fk_link_show_genre_shows_show_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_link_show_genre_shows_show_id");
});
modelBuilder.Entity("people_metadata_id", b =>
@ -1131,16 +1147,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderID")
.HasConstraintName("fk_people_metadata_id_providers_provider_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_people_metadata_id_providers_provider_id");
b.HasOne("Kyoo.Abstractions.Models.People", null)
.WithMany("ExternalIDs")
.HasForeignKey("ResourceID")
.HasConstraintName("fk_people_metadata_id_people_people_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_people_metadata_id_people_people_id");
b.Navigation("Provider");
});
@ -1150,16 +1166,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderID")
.HasConstraintName("fk_season_metadata_id_providers_provider_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_season_metadata_id_providers_provider_id");
b.HasOne("Kyoo.Abstractions.Models.Season", null)
.WithMany("ExternalIDs")
.HasForeignKey("ResourceID")
.HasConstraintName("fk_season_metadata_id_seasons_season_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_season_metadata_id_seasons_season_id");
b.Navigation("Provider");
});
@ -1169,16 +1185,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderID")
.HasConstraintName("fk_show_metadata_id_providers_provider_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_show_metadata_id_providers_provider_id");
b.HasOne("Kyoo.Abstractions.Models.Show", null)
.WithMany("ExternalIDs")
.HasForeignKey("ResourceID")
.HasConstraintName("fk_show_metadata_id_shows_show_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_show_metadata_id_shows_show_id");
b.Navigation("Provider");
});
@ -1188,16 +1204,16 @@ namespace Kyoo.Postgresql.Migrations
b.HasOne("Kyoo.Abstractions.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderID")
.HasConstraintName("fk_studio_metadata_id_providers_provider_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_studio_metadata_id_providers_provider_id");
b.HasOne("Kyoo.Abstractions.Models.Studio", null)
.WithMany("ExternalIDs")
.HasForeignKey("ResourceID")
.HasConstraintName("fk_studio_metadata_id_studios_studio_id")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_studio_metadata_id_studios_studio_id");
b.Navigation("Provider");
});

View File

@ -60,8 +60,8 @@ namespace Kyoo.Tests
Title = "New Show",
Overview = "overview",
Status = Status.Planned,
StartAir = new DateTime(2011, 1, 1),
EndAir = new DateTime(2011, 1, 1),
StartAir = new DateTime(2011, 1, 1).ToUniversalTime(),
EndAir = new DateTime(2011, 1, 1).ToUniversalTime(),
Images = new Dictionary<int, string>
{
[Images.Poster] = "Poster",
@ -81,9 +81,9 @@ namespace Kyoo.Tests
ShowSlug = Get<Show>().Slug,
Title = "New season",
Overview = "New overview",
EndDate = new DateTime(2000, 10, 10),
EndDate = new DateTime(2000, 10, 10).ToUniversalTime(),
SeasonNumber = 2,
StartDate = new DateTime(2010, 10, 10),
StartDate = new DateTime(2010, 10, 10).ToUniversalTime(),
Images = new Dictionary<int, string>
{
[Images.Logo] = "logo"
@ -103,7 +103,7 @@ namespace Kyoo.Tests
AbsoluteNumber = 4,
Path = "/episode-path",
Title = "New Episode Title",
ReleaseDate = new DateTime(2000, 10, 10),
ReleaseDate = new DateTime(2000, 10, 10).ToUniversalTime(),
Overview = "new episode overview",
Images = new Dictionary<int, string>
{
@ -184,8 +184,8 @@ namespace Kyoo.Tests
"school students, they had long ceased to think of each other as friends.",
Status = Status.Finished,
StudioID = 1,
StartAir = new DateTime(2011, 1, 1),
EndAir = new DateTime(2011, 1, 1),
StartAir = new DateTime(2011, 1, 1).ToUniversalTime(),
EndAir = new DateTime(2011, 1, 1).ToUniversalTime(),
Images = new Dictionary<int, string>
{
[Images.Poster] = "Poster",
@ -206,8 +206,8 @@ namespace Kyoo.Tests
SeasonNumber = 1,
Title = "Season 1",
Overview = "The first season",
StartDate = new DateTime(2020, 06, 05),
EndDate = new DateTime(2020, 07, 05),
StartDate = new DateTime(2020, 06, 05).ToUniversalTime(),
EndDate = new DateTime(2020, 07, 05).ToUniversalTime(),
Images = new Dictionary<int, string>
{
[Images.Poster] = "Poster",
@ -236,7 +236,7 @@ namespace Kyoo.Tests
},
Title = "Episode 1",
Overview = "Summary of the first episode",
ReleaseDate = new DateTime(2020, 06, 05)
ReleaseDate = new DateTime(2020, 06, 05).ToUniversalTime()
}
},
{
@ -415,7 +415,7 @@ namespace Kyoo.Tests
},
Title = "Episode 3",
Overview = "Summary of the third absolute episode",
ReleaseDate = new DateTime(2020, 06, 05)
ReleaseDate = new DateTime(2020, 06, 05).ToUniversalTime()
};
}
@ -435,7 +435,7 @@ namespace Kyoo.Tests
},
Title = "John wick",
Overview = "A movie episode test",
ReleaseDate = new DateTime(1595, 05, 12)
ReleaseDate = new DateTime(1595, 05, 12).ToUniversalTime()
};
}
}

View File

@ -1,6 +1,11 @@
{pkgs ? import <nixpkgs> {}}: let
venvDir = "./scanner/.venv";
pythonPkgs = ./scanner/requirements.txt;
dotnet = with pkgs.dotnetCorePackages;
combinePackages [
sdk_7_0
aspnetcore_7_0
];
in
pkgs.mkShell {
packages = with pkgs; [
@ -8,11 +13,7 @@ in
nodePackages.yarn
nodePackages.eas-cli
nodePackages.expo-cli
(with dotnetCorePackages;
combinePackages [
sdk_7_0
aspnetcore_7_0
])
dotnet
python3
python3Packages.pip
cargo
@ -26,6 +27,7 @@ in
];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
DOTNET_ROOT = "${dotnet}";
shellHook = ''
# Install python modules