diff --git a/back/Dockerfile b/back/Dockerfile index 3bfa1be5..862dbbfe 100644 --- a/back/Dockerfile +++ b/back/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 as builder +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 as builder ARG TARGETARCH WORKDIR /kyoo diff --git a/back/Dockerfile.dev b/back/Dockerfile.dev index 3400f1ef..53213cbb 100644 --- a/back/Dockerfile.dev +++ b/back/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 +FROM mcr.microsoft.com/dotnet/sdk:8.0 RUN apt-get update && apt-get install -y curl WORKDIR /app diff --git a/back/src/Directory.Build.props b/back/src/Directory.Build.props index 1d56c929..34530a3a 100644 --- a/back/src/Directory.Build.props +++ b/back/src/Directory.Build.props @@ -1,7 +1,7 @@ - net7.0 - preview + net8.0 + default Kyoo Kyoo Copyright (c) Kyoo diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs index 817b8487..d1355714 100644 --- a/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs +++ b/back/src/Kyoo.Abstractions/Models/Exceptions/DuplicatedItemException.cs @@ -17,7 +17,6 @@ // along with Kyoo. If not, see . using System; -using System.Runtime.Serialization; namespace Kyoo.Abstractions.Models.Exceptions; @@ -25,28 +24,10 @@ namespace Kyoo.Abstractions.Models.Exceptions; /// An exception raised when an item already exists in the database. /// [Serializable] -public class DuplicatedItemException : Exception +public class DuplicatedItemException(object? existing = null) : Exception("Already exists in the database.") { /// /// The existing object. /// - public object? Existing { get; } - - /// - /// Create a new with the default message. - /// - /// The existing object. - public DuplicatedItemException(object? existing = null) - : base("Already exists in the database.") - { - Existing = existing; - } - - /// - /// The serialization constructor. - /// - /// Serialization infos - /// The serialization context - protected DuplicatedItemException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + public object? Existing { get; } = existing; } diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs index eeeffc79..ef708f84 100644 --- a/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs +++ b/back/src/Kyoo.Abstractions/Models/Exceptions/ItemNotFoundException.cs @@ -17,7 +17,6 @@ // along with Kyoo. If not, see . using System; -using System.Runtime.Serialization; namespace Kyoo.Abstractions.Models.Exceptions; @@ -39,12 +38,4 @@ public class ItemNotFoundException : Exception /// The message of the exception public ItemNotFoundException(string message) : base(message) { } - - /// - /// The serialization constructor - /// - /// Serialization infos - /// The serialization context - protected ItemNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) { } } diff --git a/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs b/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs index af0eae6c..89f09d7a 100644 --- a/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs +++ b/back/src/Kyoo.Abstractions/Models/Exceptions/UnauthorizedException.cs @@ -17,7 +17,6 @@ // along with Kyoo. If not, see . using System; -using System.Runtime.Serialization; namespace Kyoo.Abstractions.Models.Exceptions; @@ -29,7 +28,4 @@ public class UnauthorizedException : Exception public UnauthorizedException(string message) : base(message) { } - - protected UnauthorizedException(SerializationInfo info, StreamingContext context) - : base(info, context) { } } diff --git a/back/src/Kyoo.Authentication/Views/AuthApi.cs b/back/src/Kyoo.Authentication/Views/AuthApi.cs index 4ab46f64..6e3548f2 100644 --- a/back/src/Kyoo.Authentication/Views/AuthApi.cs +++ b/back/src/Kyoo.Authentication/Views/AuthApi.cs @@ -446,7 +446,7 @@ public class AuthApi( { Stream img = await thumbs.GetUserImage(User.GetIdOrThrow()); // Allow clients to cache the image for 6 month. - Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}"); + Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}"; return File(img, "image/webp", true); } diff --git a/back/src/Kyoo.Core/Views/Helper/CrudThumbsApi.cs b/back/src/Kyoo.Core/Views/Helper/CrudThumbsApi.cs index c0978878..3d9ec375 100644 --- a/back/src/Kyoo.Core/Views/Helper/CrudThumbsApi.cs +++ b/back/src/Kyoo.Core/Views/Helper/CrudThumbsApi.cs @@ -74,10 +74,10 @@ public class CrudThumbsApi : CrudApi if (!identifier.Match(id => false, slug => slug == "random")) { // Allow clients to cache the image for 6 month. - Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}"); + Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}"; } else - Response.Headers.Add("Cache-Control", $"public, no-store"); + Response.Headers.CacheControl = $"public, no-store"; return PhysicalFile(Path.GetFullPath(path), "image/webp", true); } diff --git a/back/src/Kyoo.Core/Views/Resources/UserApi.cs b/back/src/Kyoo.Core/Views/Resources/UserApi.cs index 345037d6..63d00d7d 100644 --- a/back/src/Kyoo.Core/Views/Resources/UserApi.cs +++ b/back/src/Kyoo.Core/Views/Resources/UserApi.cs @@ -59,11 +59,11 @@ public class UserApi(ILibraryManager libraryManager, IThumbnailsManager thumbs) ); Stream img = await thumbs.GetUserImage(gid); if (identifier.Is("random")) - Response.Headers.Add("Cache-Control", $"public, no-store"); + Response.Headers.CacheControl = $"public, no-store"; else { // Allow clients to cache the image for 6 month. - Response.Headers.Add("Cache-Control", $"public, max-age={60 * 60 * 24 * 31 * 6}"); + Response.Headers.CacheControl = $"public, max-age={60 * 60 * 24 * 31 * 6}"; } return File(img, "image/webp", true); } diff --git a/back/src/Kyoo.Postgresql/Migrations/20231128171554_Initial.cs b/back/src/Kyoo.Postgresql/Migrations/20231128171554_Initial.cs index 72469330..958e29de 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20231128171554_Initial.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20231128171554_Initial.cs @@ -23,548 +23,547 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class Initial : Migration { /// - public partial class Initial : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - 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" + 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:status", "unknown,finished,airing,planned"); + + migrationBuilder.CreateTable( + name: "collections", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + 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), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + 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: "studios", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + 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: "uuid", nullable: false), + 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), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + logo_source = table.Column(type: "text", nullable: true), + logo_blurhash = table.Column( + type: "character varying(32)", + maxLength: 32, + nullable: true ) - .Annotation("Npgsql:Enum:status", "unknown,finished,airing,planned"); + }, + constraints: table => + { + table.PrimaryKey("pk_users", x => x.id); + } + ); - migrationBuilder.CreateTable( - name: "collections", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - 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), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - 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: "movies", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + 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), + rating = table.Column(type: "integer", nullable: false), + runtime = table.Column(type: "integer", nullable: false), + air_date = table.Column( + type: "timestamp with time zone", + nullable: true + ), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + 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: "uuid", 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: "studios", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - 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: "shows", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + 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), + rating = table.Column(type: "integer", nullable: false), + start_air = table.Column( + type: "timestamp with time zone", + nullable: true + ), + end_air = table.Column( + type: "timestamp with time zone", + nullable: true + ), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + 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: "uuid", 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: "users", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - 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), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - 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: "link_collection_movie", + columns: table => new + { + collection_id = table.Column(type: "uuid", nullable: false), + movie_id = table.Column(type: "uuid", 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: "movies", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - 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), - rating = table.Column(type: "integer", nullable: false), - runtime = table.Column(type: "integer", nullable: false), - air_date = table.Column( - type: "timestamp with time zone", - nullable: true - ), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - 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: "uuid", 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: "link_collection_show", + columns: table => new + { + collection_id = table.Column(type: "uuid", nullable: false), + show_id = table.Column(type: "uuid", 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: "shows", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - 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), - rating = table.Column(type: "integer", nullable: false), - start_air = table.Column( - type: "timestamp with time zone", - nullable: true - ), - end_air = table.Column( - type: "timestamp with time zone", - nullable: true - ), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - 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: "uuid", 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: "seasons", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + slug = table.Column( + type: "character varying(256)", + maxLength: 256, + nullable: false + ), + show_id = table.Column(type: "uuid", nullable: false), + season_number = table.Column(type: "integer", nullable: false), + name = table.Column(type: "text", nullable: true), + overview = table.Column(type: "text", nullable: true), + start_date = table.Column( + type: "timestamp with time zone", + nullable: true + ), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + end_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 + ), + external_id = table.Column(type: "json", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_seasons", x => x.id); + table.ForeignKey( + name: "fk_seasons_shows_show_id", + column: x => x.show_id, + principalTable: "shows", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + } + ); - migrationBuilder.CreateTable( - name: "link_collection_movie", - columns: table => new - { - collection_id = table.Column(type: "uuid", nullable: false), - movie_id = table.Column(type: "uuid", 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: "episodes", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + slug = table.Column( + type: "character varying(256)", + maxLength: 256, + nullable: false + ), + show_id = table.Column(type: "uuid", nullable: false), + season_id = table.Column(type: "uuid", nullable: true), + season_number = table.Column(type: "integer", nullable: true), + episode_number = table.Column(type: "integer", nullable: true), + absolute_number = table.Column(type: "integer", nullable: true), + path = table.Column(type: "text", nullable: false), + name = table.Column(type: "text", nullable: true), + overview = table.Column(type: "text", nullable: true), + runtime = table.Column(type: "integer", nullable: false), + release_date = table.Column( + type: "timestamp with time zone", + nullable: true + ), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + 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_episodes", x => x.id); + table.ForeignKey( + name: "fk_episodes_seasons_season_id", + column: x => x.season_id, + principalTable: "seasons", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + table.ForeignKey( + name: "fk_episodes_shows_show_id", + column: x => x.show_id, + principalTable: "shows", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + } + ); - migrationBuilder.CreateTable( - name: "link_collection_show", - columns: table => new - { - collection_id = table.Column(type: "uuid", nullable: false), - show_id = table.Column(type: "uuid", 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.CreateIndex( + name: "ix_collections_slug", + table: "collections", + column: "slug", + unique: true + ); - migrationBuilder.CreateTable( - name: "seasons", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - slug = table.Column( - type: "character varying(256)", - maxLength: 256, - nullable: false - ), - show_id = table.Column(type: "uuid", nullable: false), - season_number = table.Column(type: "integer", nullable: false), - name = table.Column(type: "text", nullable: true), - overview = table.Column(type: "text", nullable: true), - start_date = table.Column( - type: "timestamp with time zone", - nullable: true - ), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - end_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 - ), - external_id = table.Column(type: "json", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_seasons", x => x.id); - table.ForeignKey( - name: "fk_seasons_shows_show_id", - column: x => x.show_id, - principalTable: "shows", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - } - ); + migrationBuilder.CreateIndex( + name: "ix_episodes_season_id", + table: "episodes", + column: "season_id" + ); - migrationBuilder.CreateTable( - name: "episodes", - columns: table => new - { - id = table.Column(type: "uuid", nullable: false), - slug = table.Column( - type: "character varying(256)", - maxLength: 256, - nullable: false - ), - show_id = table.Column(type: "uuid", nullable: false), - season_id = table.Column(type: "uuid", nullable: true), - season_number = table.Column(type: "integer", nullable: true), - episode_number = table.Column(type: "integer", nullable: true), - absolute_number = table.Column(type: "integer", nullable: true), - path = table.Column(type: "text", nullable: false), - name = table.Column(type: "text", nullable: true), - overview = table.Column(type: "text", nullable: true), - runtime = table.Column(type: "integer", nullable: false), - release_date = table.Column( - type: "timestamp with time zone", - nullable: true - ), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - 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_episodes", x => x.id); - table.ForeignKey( - name: "fk_episodes_seasons_season_id", - column: x => x.season_id, - principalTable: "seasons", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - table.ForeignKey( - name: "fk_episodes_shows_show_id", - column: x => x.show_id, - principalTable: "shows", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - } - ); + migrationBuilder.CreateIndex( + name: "ix_episodes_show_id_season_number_episode_number_absolute_numb", + table: "episodes", + columns: new[] { "show_id", "season_number", "episode_number", "absolute_number" }, + unique: true + ); - migrationBuilder.CreateIndex( - name: "ix_collections_slug", - table: "collections", - column: "slug", - unique: true - ); + migrationBuilder.CreateIndex( + name: "ix_episodes_slug", + table: "episodes", + column: "slug", + unique: true + ); - migrationBuilder.CreateIndex( - name: "ix_episodes_season_id", - table: "episodes", - column: "season_id" - ); + migrationBuilder.CreateIndex( + name: "ix_link_collection_movie_movie_id", + table: "link_collection_movie", + column: "movie_id" + ); - migrationBuilder.CreateIndex( - name: "ix_episodes_show_id_season_number_episode_number_absolute_numb", - table: "episodes", - columns: new[] { "show_id", "season_number", "episode_number", "absolute_number" }, - unique: true - ); + migrationBuilder.CreateIndex( + name: "ix_link_collection_show_show_id", + table: "link_collection_show", + column: "show_id" + ); - migrationBuilder.CreateIndex( - name: "ix_episodes_slug", - table: "episodes", - column: "slug", - unique: true - ); + migrationBuilder.CreateIndex( + name: "ix_movies_slug", + table: "movies", + column: "slug", + unique: true + ); - migrationBuilder.CreateIndex( - name: "ix_link_collection_movie_movie_id", - table: "link_collection_movie", - column: "movie_id" - ); + migrationBuilder.CreateIndex( + name: "ix_movies_studio_id", + table: "movies", + column: "studio_id" + ); - migrationBuilder.CreateIndex( - name: "ix_link_collection_show_show_id", - table: "link_collection_show", - column: "show_id" - ); + migrationBuilder.CreateIndex( + name: "ix_seasons_show_id_season_number", + table: "seasons", + columns: new[] { "show_id", "season_number" }, + unique: true + ); - migrationBuilder.CreateIndex( - name: "ix_movies_slug", - table: "movies", - column: "slug", - unique: true - ); + migrationBuilder.CreateIndex( + name: "ix_seasons_slug", + table: "seasons", + column: "slug", + unique: true + ); - migrationBuilder.CreateIndex( - name: "ix_movies_studio_id", - table: "movies", - column: "studio_id" - ); + migrationBuilder.CreateIndex( + name: "ix_shows_slug", + table: "shows", + column: "slug", + unique: true + ); - migrationBuilder.CreateIndex( - name: "ix_seasons_show_id_season_number", - table: "seasons", - columns: new[] { "show_id", "season_number" }, - unique: true - ); + migrationBuilder.CreateIndex( + name: "ix_shows_studio_id", + table: "shows", + column: "studio_id" + ); - migrationBuilder.CreateIndex( - name: "ix_seasons_slug", - table: "seasons", - column: "slug", - unique: true - ); + migrationBuilder.CreateIndex( + name: "ix_studios_slug", + table: "studios", + column: "slug", + unique: true + ); - migrationBuilder.CreateIndex( - name: "ix_shows_slug", - table: "shows", - column: "slug", - unique: true - ); + migrationBuilder.CreateIndex( + name: "ix_users_slug", + table: "users", + column: "slug", + unique: true + ); + } - migrationBuilder.CreateIndex( - name: "ix_shows_studio_id", - table: "shows", - column: "studio_id" - ); + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable(name: "episodes"); - migrationBuilder.CreateIndex( - name: "ix_studios_slug", - table: "studios", - column: "slug", - unique: true - ); + migrationBuilder.DropTable(name: "link_collection_movie"); - migrationBuilder.CreateIndex( - name: "ix_users_slug", - table: "users", - column: "slug", - unique: true - ); - } + migrationBuilder.DropTable(name: "link_collection_show"); - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable(name: "episodes"); + migrationBuilder.DropTable(name: "users"); - migrationBuilder.DropTable(name: "link_collection_movie"); + migrationBuilder.DropTable(name: "seasons"); - migrationBuilder.DropTable(name: "link_collection_show"); + migrationBuilder.DropTable(name: "movies"); - migrationBuilder.DropTable(name: "users"); + migrationBuilder.DropTable(name: "collections"); - migrationBuilder.DropTable(name: "seasons"); + migrationBuilder.DropTable(name: "shows"); - migrationBuilder.DropTable(name: "movies"); - - migrationBuilder.DropTable(name: "collections"); - - migrationBuilder.DropTable(name: "shows"); - - migrationBuilder.DropTable(name: "studios"); - } + migrationBuilder.DropTable(name: "studios"); } } diff --git a/back/src/Kyoo.Postgresql/Migrations/20231204000849_Watchlist.cs b/back/src/Kyoo.Postgresql/Migrations/20231204000849_Watchlist.cs index 85630e77..5d2c5b79 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20231204000849_Watchlist.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20231204000849_Watchlist.cs @@ -22,203 +22,202 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class Watchlist : Migration { /// - public partial class Watchlist : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - 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:status", "unknown,finished,airing,planned") - .Annotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned") - .OldAnnotation( - "Npgsql:Enum:genre", - "action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western" - ) - .OldAnnotation("Npgsql:Enum:status", "unknown,finished,airing,planned"); + 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:status", "unknown,finished,airing,planned") + .Annotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned") + .OldAnnotation( + "Npgsql:Enum:genre", + "action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western" + ) + .OldAnnotation("Npgsql:Enum:status", "unknown,finished,airing,planned"); - migrationBuilder.CreateTable( - name: "episode_watch_status", - columns: table => new - { - user_id = table.Column(type: "uuid", nullable: false), - episode_id = table.Column(type: "uuid", nullable: false), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - played_date = table.Column( - type: "timestamp with time zone", - nullable: true - ), - status = table.Column(type: "watch_status", nullable: false), - watched_time = table.Column(type: "integer", nullable: true), - watched_percent = table.Column(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey( - "pk_episode_watch_status", - x => new { x.user_id, x.episode_id } - ); - table.ForeignKey( - name: "fk_episode_watch_status_episodes_episode_id", - column: x => x.episode_id, - principalTable: "episodes", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - table.ForeignKey( - name: "fk_episode_watch_status_users_user_id", - column: x => x.user_id, - principalTable: "users", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - } - ); + migrationBuilder.CreateTable( + name: "episode_watch_status", + columns: table => new + { + user_id = table.Column(type: "uuid", nullable: false), + episode_id = table.Column(type: "uuid", nullable: false), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + played_date = table.Column( + type: "timestamp with time zone", + nullable: true + ), + status = table.Column(type: "watch_status", nullable: false), + watched_time = table.Column(type: "integer", nullable: true), + watched_percent = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey( + "pk_episode_watch_status", + x => new { x.user_id, x.episode_id } + ); + table.ForeignKey( + name: "fk_episode_watch_status_episodes_episode_id", + column: x => x.episode_id, + principalTable: "episodes", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + table.ForeignKey( + name: "fk_episode_watch_status_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + } + ); - migrationBuilder.CreateTable( - name: "movie_watch_status", - columns: table => new - { - user_id = table.Column(type: "uuid", nullable: false), - movie_id = table.Column(type: "uuid", nullable: false), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - played_date = table.Column( - type: "timestamp with time zone", - nullable: true - ), - status = table.Column(type: "watch_status", nullable: false), - watched_time = table.Column(type: "integer", nullable: true), - watched_percent = table.Column(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_movie_watch_status", x => new { x.user_id, x.movie_id }); - table.ForeignKey( - name: "fk_movie_watch_status_movies_movie_id", - column: x => x.movie_id, - principalTable: "movies", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - table.ForeignKey( - name: "fk_movie_watch_status_users_user_id", - column: x => x.user_id, - principalTable: "users", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - } - ); + migrationBuilder.CreateTable( + name: "movie_watch_status", + columns: table => new + { + user_id = table.Column(type: "uuid", nullable: false), + movie_id = table.Column(type: "uuid", nullable: false), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + played_date = table.Column( + type: "timestamp with time zone", + nullable: true + ), + status = table.Column(type: "watch_status", nullable: false), + watched_time = table.Column(type: "integer", nullable: true), + watched_percent = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_movie_watch_status", x => new { x.user_id, x.movie_id }); + table.ForeignKey( + name: "fk_movie_watch_status_movies_movie_id", + column: x => x.movie_id, + principalTable: "movies", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + table.ForeignKey( + name: "fk_movie_watch_status_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + } + ); - migrationBuilder.CreateTable( - name: "show_watch_status", - columns: table => new - { - user_id = table.Column(type: "uuid", nullable: false), - show_id = table.Column(type: "uuid", nullable: false), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ), - played_date = table.Column( - type: "timestamp with time zone", - nullable: true - ), - status = table.Column(type: "watch_status", nullable: false), - unseen_episodes_count = table.Column(type: "integer", nullable: false), - next_episode_id = table.Column(type: "uuid", nullable: true), - watched_time = table.Column(type: "integer", nullable: true), - watched_percent = table.Column(type: "integer", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("pk_show_watch_status", x => new { x.user_id, x.show_id }); - table.ForeignKey( - name: "fk_show_watch_status_episodes_next_episode_id", - column: x => x.next_episode_id, - principalTable: "episodes", - principalColumn: "id" - ); - table.ForeignKey( - name: "fk_show_watch_status_shows_show_id", - column: x => x.show_id, - principalTable: "shows", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - table.ForeignKey( - name: "fk_show_watch_status_users_user_id", - column: x => x.user_id, - principalTable: "users", - principalColumn: "id", - onDelete: ReferentialAction.Cascade - ); - } - ); + migrationBuilder.CreateTable( + name: "show_watch_status", + columns: table => new + { + user_id = table.Column(type: "uuid", nullable: false), + show_id = table.Column(type: "uuid", nullable: false), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ), + played_date = table.Column( + type: "timestamp with time zone", + nullable: true + ), + status = table.Column(type: "watch_status", nullable: false), + unseen_episodes_count = table.Column(type: "integer", nullable: false), + next_episode_id = table.Column(type: "uuid", nullable: true), + watched_time = table.Column(type: "integer", nullable: true), + watched_percent = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("pk_show_watch_status", x => new { x.user_id, x.show_id }); + table.ForeignKey( + name: "fk_show_watch_status_episodes_next_episode_id", + column: x => x.next_episode_id, + principalTable: "episodes", + principalColumn: "id" + ); + table.ForeignKey( + name: "fk_show_watch_status_shows_show_id", + column: x => x.show_id, + principalTable: "shows", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + table.ForeignKey( + name: "fk_show_watch_status_users_user_id", + column: x => x.user_id, + principalTable: "users", + principalColumn: "id", + onDelete: ReferentialAction.Cascade + ); + } + ); - migrationBuilder.CreateIndex( - name: "ix_episode_watch_status_episode_id", - table: "episode_watch_status", - column: "episode_id" - ); + migrationBuilder.CreateIndex( + name: "ix_episode_watch_status_episode_id", + table: "episode_watch_status", + column: "episode_id" + ); - migrationBuilder.CreateIndex( - name: "ix_movie_watch_status_movie_id", - table: "movie_watch_status", - column: "movie_id" - ); + migrationBuilder.CreateIndex( + name: "ix_movie_watch_status_movie_id", + table: "movie_watch_status", + column: "movie_id" + ); - migrationBuilder.CreateIndex( - name: "ix_show_watch_status_next_episode_id", - table: "show_watch_status", - column: "next_episode_id" - ); + migrationBuilder.CreateIndex( + name: "ix_show_watch_status_next_episode_id", + table: "show_watch_status", + column: "next_episode_id" + ); - migrationBuilder.CreateIndex( - name: "ix_show_watch_status_show_id", - table: "show_watch_status", - column: "show_id" - ); - } + migrationBuilder.CreateIndex( + name: "ix_show_watch_status_show_id", + table: "show_watch_status", + column: "show_id" + ); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable(name: "episode_watch_status"); + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable(name: "episode_watch_status"); - migrationBuilder.DropTable(name: "movie_watch_status"); + migrationBuilder.DropTable(name: "movie_watch_status"); - migrationBuilder.DropTable(name: "show_watch_status"); + migrationBuilder.DropTable(name: "show_watch_status"); - 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:status", "unknown,finished,airing,planned") - .OldAnnotation( - "Npgsql:Enum:genre", - "action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western" - ) - .OldAnnotation("Npgsql:Enum:status", "unknown,finished,airing,planned") - .OldAnnotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned"); - } + 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:status", "unknown,finished,airing,planned") + .OldAnnotation( + "Npgsql:Enum:genre", + "action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western" + ) + .OldAnnotation("Npgsql:Enum:status", "unknown,finished,airing,planned") + .OldAnnotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned"); } } diff --git a/back/src/Kyoo.Postgresql/Migrations/20231220093441_Settings.cs b/back/src/Kyoo.Postgresql/Migrations/20231220093441_Settings.cs index 3f2c08c2..8eb837cd 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20231220093441_Settings.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20231220093441_Settings.cs @@ -2,27 +2,26 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class Settings : Migration { /// - public partial class Settings : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "settings", - table: "users", - type: "json", - nullable: false, - defaultValue: "{}" - ); - } + migrationBuilder.AddColumn( + name: "settings", + table: "users", + type: "json", + nullable: false, + defaultValue: "{}" + ); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn(name: "settings", table: "users"); - } + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn(name: "settings", table: "users"); } } diff --git a/back/src/Kyoo.Postgresql/Migrations/20240120154137_RuntimeNullable.cs b/back/src/Kyoo.Postgresql/Migrations/20240120154137_RuntimeNullable.cs index 2510270e..63ec85c9 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20240120154137_RuntimeNullable.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20240120154137_RuntimeNullable.cs @@ -1,58 +1,57 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class RuntimeNullable : Migration { /// - public partial class RuntimeNullable : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "runtime", - table: "movies", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer" - ); + migrationBuilder.AlterColumn( + name: "runtime", + table: "movies", + type: "integer", + nullable: true, + oldClrType: typeof(int), + oldType: "integer" + ); - migrationBuilder.AlterColumn( - name: "runtime", - table: "episodes", - type: "integer", - nullable: true, - oldClrType: typeof(int), - oldType: "integer" - ); - } + migrationBuilder.AlterColumn( + name: "runtime", + table: "episodes", + type: "integer", + nullable: true, + oldClrType: typeof(int), + oldType: "integer" + ); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "runtime", - table: "movies", - type: "integer", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true - ); + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "runtime", + table: "movies", + type: "integer", + nullable: false, + defaultValue: 0, + oldClrType: typeof(int), + oldType: "integer", + oldNullable: true + ); - migrationBuilder.AlterColumn( - name: "runtime", - table: "episodes", - type: "integer", - nullable: false, - defaultValue: 0, - oldClrType: typeof(int), - oldType: "integer", - oldNullable: true - ); - } + migrationBuilder.AlterColumn( + name: "runtime", + table: "episodes", + type: "integer", + nullable: false, + defaultValue: 0, + oldClrType: typeof(int), + oldType: "integer", + oldNullable: true + ); } } diff --git a/back/src/Kyoo.Postgresql/Migrations/20240204193443_RemoveUserLogo.cs b/back/src/Kyoo.Postgresql/Migrations/20240204193443_RemoveUserLogo.cs index bef7be5a..6907cb10 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20240204193443_RemoveUserLogo.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20240204193443_RemoveUserLogo.cs @@ -1,35 +1,34 @@ using Microsoft.EntityFrameworkCore.Migrations; -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class RemoveUserLogo : Migration { /// - public partial class RemoveUserLogo : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn(name: "logo_blurhash", table: "users"); + migrationBuilder.DropColumn(name: "logo_blurhash", table: "users"); - migrationBuilder.DropColumn(name: "logo_source", table: "users"); - } + migrationBuilder.DropColumn(name: "logo_source", table: "users"); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "logo_blurhash", - table: "users", - type: "character varying(32)", - maxLength: 32, - nullable: true - ); + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "logo_blurhash", + table: "users", + type: "character varying(32)", + maxLength: 32, + nullable: true + ); - migrationBuilder.AddColumn( - name: "logo_source", - table: "users", - type: "text", - nullable: true - ); - } + migrationBuilder.AddColumn( + name: "logo_source", + table: "users", + type: "text", + nullable: true + ); } } diff --git a/back/src/Kyoo.Postgresql/Migrations/20240217143306_AddIssues.cs b/back/src/Kyoo.Postgresql/Migrations/20240217143306_AddIssues.cs index f4763cf6..8aec0204 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20240217143306_AddIssues.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20240217143306_AddIssues.cs @@ -3,66 +3,65 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class AddIssues : Migration { /// - public partial class AddIssues : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_show_watch_status_episodes_next_episode_id", - table: "show_watch_status" - ); + migrationBuilder.DropForeignKey( + name: "fk_show_watch_status_episodes_next_episode_id", + table: "show_watch_status" + ); - migrationBuilder.CreateTable( - name: "issues", - columns: table => new - { - domain = table.Column(type: "text", nullable: false), - cause = table.Column(type: "text", nullable: false), - reason = table.Column(type: "text", nullable: false), - extra = table.Column(type: "json", nullable: false), - added_date = table.Column( - type: "timestamp with time zone", - nullable: false, - defaultValueSql: "now() at time zone 'utc'" - ) - }, - constraints: table => - { - table.PrimaryKey("pk_issues", x => new { x.domain, x.cause }); - } - ); + migrationBuilder.CreateTable( + name: "issues", + columns: table => new + { + domain = table.Column(type: "text", nullable: false), + cause = table.Column(type: "text", nullable: false), + reason = table.Column(type: "text", nullable: false), + extra = table.Column(type: "json", nullable: false), + added_date = table.Column( + type: "timestamp with time zone", + nullable: false, + defaultValueSql: "now() at time zone 'utc'" + ) + }, + constraints: table => + { + table.PrimaryKey("pk_issues", x => new { x.domain, x.cause }); + } + ); - migrationBuilder.AddForeignKey( - name: "fk_show_watch_status_episodes_next_episode_id", - table: "show_watch_status", - column: "next_episode_id", - principalTable: "episodes", - principalColumn: "id", - onDelete: ReferentialAction.SetNull - ); - } + migrationBuilder.AddForeignKey( + name: "fk_show_watch_status_episodes_next_episode_id", + table: "show_watch_status", + column: "next_episode_id", + principalTable: "episodes", + principalColumn: "id", + onDelete: ReferentialAction.SetNull + ); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "fk_show_watch_status_episodes_next_episode_id", - table: "show_watch_status" - ); + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_show_watch_status_episodes_next_episode_id", + table: "show_watch_status" + ); - migrationBuilder.DropTable(name: "issues"); + migrationBuilder.DropTable(name: "issues"); - migrationBuilder.AddForeignKey( - name: "fk_show_watch_status_episodes_next_episode_id", - table: "show_watch_status", - column: "next_episode_id", - principalTable: "episodes", - principalColumn: "id" - ); - } + migrationBuilder.AddForeignKey( + name: "fk_show_watch_status_episodes_next_episode_id", + table: "show_watch_status", + column: "next_episode_id", + principalTable: "episodes", + principalColumn: "id" + ); } } diff --git a/back/src/Kyoo.Postgresql/Migrations/20240219170615_AddPlayPermission.cs b/back/src/Kyoo.Postgresql/Migrations/20240219170615_AddPlayPermission.cs index 8853e760..0144dbdb 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20240219170615_AddPlayPermission.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20240219170615_AddPlayPermission.cs @@ -2,21 +2,20 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class AddPlayPermission : Migration { /// - public partial class AddPlayPermission : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - // language=PostgreSQL - migrationBuilder.Sql( - "update users set permissions = ARRAY_APPEND(permissions, 'overall.play');" - ); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) { } + // language=PostgreSQL + migrationBuilder.Sql( + "update users set permissions = ARRAY_APPEND(permissions, 'overall.play');" + ); } + + /// + protected override void Down(MigrationBuilder migrationBuilder) { } } diff --git a/back/src/Kyoo.Postgresql/Migrations/20240229202049_AddUserExternalId.cs b/back/src/Kyoo.Postgresql/Migrations/20240229202049_AddUserExternalId.cs index 3bf1d35c..4eda4dfc 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20240229202049_AddUserExternalId.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20240229202049_AddUserExternalId.cs @@ -2,27 +2,26 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class AddUserExternalId : Migration { /// - public partial class AddUserExternalId : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "external_id", - table: "users", - type: "json", - nullable: false, - defaultValue: "{}" - ); - } + migrationBuilder.AddColumn( + name: "external_id", + table: "users", + type: "json", + nullable: false, + defaultValue: "{}" + ); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn(name: "external_id", table: "users"); - } + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn(name: "external_id", table: "users"); } } diff --git a/back/src/Kyoo.Postgresql/Migrations/20240302151906_MakePasswordOptional.cs b/back/src/Kyoo.Postgresql/Migrations/20240302151906_MakePasswordOptional.cs index 0a2e9503..c6ff637e 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20240302151906_MakePasswordOptional.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20240302151906_MakePasswordOptional.cs @@ -2,37 +2,36 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace Kyoo.Postgresql.Migrations +namespace Kyoo.Postgresql.Migrations; + +/// +public partial class MakePasswordOptional : Migration { /// - public partial class MakePasswordOptional : Migration + protected override void Up(MigrationBuilder migrationBuilder) { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "password", - table: "users", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text" - ); - } + migrationBuilder.AlterColumn( + name: "password", + table: "users", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text" + ); + } - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "password", - table: "users", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true - ); - } + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "password", + table: "users", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true + ); } } diff --git a/shell.nix b/shell.nix index 82de17e8..09055872 100644 --- a/shell.nix +++ b/shell.nix @@ -8,8 +8,8 @@ ]); dotnet = with pkgs.dotnetCorePackages; combinePackages [ - sdk_7_0 - aspnetcore_7_0 + sdk_8_0 + aspnetcore_8_0 aspnetcore_6_0 ]; in