mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-03 05:34:23 -04:00
Migrate to dotnet8
This commit is contained in:
parent
5fedce71a0
commit
5a461bca7d
@ -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
|
ARG TARGETARCH
|
||||||
WORKDIR /kyoo
|
WORKDIR /kyoo
|
||||||
|
|
||||||
|
@ -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
|
RUN apt-get update && apt-get install -y curl
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<LangVersion>preview</LangVersion>
|
<LangVersion>default</LangVersion>
|
||||||
<Company>Kyoo</Company>
|
<Company>Kyoo</Company>
|
||||||
<Authors>Kyoo</Authors>
|
<Authors>Kyoo</Authors>
|
||||||
<Copyright>Copyright (c) Kyoo</Copyright>
|
<Copyright>Copyright (c) Kyoo</Copyright>
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
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.
|
/// An exception raised when an item already exists in the database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class DuplicatedItemException : Exception
|
public class DuplicatedItemException(object? existing = null) : Exception("Already exists in the database.")
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The existing object.
|
/// The existing object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object? Existing { get; }
|
public object? Existing { get; } = existing;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a new <see cref="DuplicatedItemException"/> with the default message.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="existing">The existing object.</param>
|
|
||||||
public DuplicatedItemException(object? existing = null)
|
|
||||||
: base("Already exists in the database.")
|
|
||||||
{
|
|
||||||
Existing = existing;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The serialization constructor.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info">Serialization infos</param>
|
|
||||||
/// <param name="context">The serialization context</param>
|
|
||||||
protected DuplicatedItemException(SerializationInfo info, StreamingContext context)
|
|
||||||
: base(info, context) { }
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
namespace Kyoo.Abstractions.Models.Exceptions;
|
||||||
|
|
||||||
@ -39,12 +38,4 @@ public class ItemNotFoundException : Exception
|
|||||||
/// <param name="message">The message of the exception</param>
|
/// <param name="message">The message of the exception</param>
|
||||||
public ItemNotFoundException(string message)
|
public ItemNotFoundException(string message)
|
||||||
: base(message) { }
|
: base(message) { }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The serialization constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info">Serialization infos</param>
|
|
||||||
/// <param name="context">The serialization context</param>
|
|
||||||
protected ItemNotFoundException(SerializationInfo info, StreamingContext context)
|
|
||||||
: base(info, context) { }
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Exceptions;
|
namespace Kyoo.Abstractions.Models.Exceptions;
|
||||||
|
|
||||||
@ -29,7 +28,4 @@ public class UnauthorizedException : Exception
|
|||||||
|
|
||||||
public UnauthorizedException(string message)
|
public UnauthorizedException(string message)
|
||||||
: base(message) { }
|
: base(message) { }
|
||||||
|
|
||||||
protected UnauthorizedException(SerializationInfo info, StreamingContext context)
|
|
||||||
: base(info, context) { }
|
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ public class AuthApi(
|
|||||||
{
|
{
|
||||||
Stream img = await thumbs.GetUserImage(User.GetIdOrThrow());
|
Stream img = await thumbs.GetUserImage(User.GetIdOrThrow());
|
||||||
// Allow clients to cache the image for 6 month.
|
// 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);
|
return File(img, "image/webp", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ public class CrudThumbsApi<T> : CrudApi<T>
|
|||||||
if (!identifier.Match(id => false, slug => slug == "random"))
|
if (!identifier.Match(id => false, slug => slug == "random"))
|
||||||
{
|
{
|
||||||
// Allow clients to cache the image for 6 month.
|
// 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
|
else
|
||||||
Response.Headers.Add("Cache-Control", $"public, no-store");
|
Response.Headers.CacheControl = $"public, no-store";
|
||||||
return PhysicalFile(Path.GetFullPath(path), "image/webp", true);
|
return PhysicalFile(Path.GetFullPath(path), "image/webp", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,11 +59,11 @@ public class UserApi(ILibraryManager libraryManager, IThumbnailsManager thumbs)
|
|||||||
);
|
);
|
||||||
Stream img = await thumbs.GetUserImage(gid);
|
Stream img = await thumbs.GetUserImage(gid);
|
||||||
if (identifier.Is("random"))
|
if (identifier.Is("random"))
|
||||||
Response.Headers.Add("Cache-Control", $"public, no-store");
|
Response.Headers.CacheControl = $"public, no-store";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Allow clients to cache the image for 6 month.
|
// 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);
|
return File(img, "image/webp", true);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -22,203 +22,202 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Watchlist : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Watchlist : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
.AlterDatabase()
|
||||||
{
|
.Annotation(
|
||||||
migrationBuilder
|
"Npgsql:Enum:genre",
|
||||||
.AlterDatabase()
|
"action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western"
|
||||||
.Annotation(
|
)
|
||||||
"Npgsql:Enum:genre",
|
.Annotation("Npgsql:Enum:status", "unknown,finished,airing,planned")
|
||||||
"action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western"
|
.Annotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned")
|
||||||
)
|
.OldAnnotation(
|
||||||
.Annotation("Npgsql:Enum:status", "unknown,finished,airing,planned")
|
"Npgsql:Enum:genre",
|
||||||
.Annotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned")
|
"action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western"
|
||||||
.OldAnnotation(
|
)
|
||||||
"Npgsql:Enum:genre",
|
.OldAnnotation("Npgsql:Enum:status", "unknown,finished,airing,planned");
|
||||||
"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(
|
migrationBuilder.CreateTable(
|
||||||
name: "episode_watch_status",
|
name: "episode_watch_status",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
user_id = table.Column<Guid>(type: "uuid", nullable: false),
|
user_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
episode_id = table.Column<Guid>(type: "uuid", nullable: false),
|
episode_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
added_date = table.Column<DateTime>(
|
added_date = table.Column<DateTime>(
|
||||||
type: "timestamp with time zone",
|
type: "timestamp with time zone",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValueSql: "now() at time zone 'utc'"
|
defaultValueSql: "now() at time zone 'utc'"
|
||||||
),
|
),
|
||||||
played_date = table.Column<DateTime>(
|
played_date = table.Column<DateTime>(
|
||||||
type: "timestamp with time zone",
|
type: "timestamp with time zone",
|
||||||
nullable: true
|
nullable: true
|
||||||
),
|
),
|
||||||
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
|
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
|
||||||
watched_time = table.Column<int>(type: "integer", nullable: true),
|
watched_time = table.Column<int>(type: "integer", nullable: true),
|
||||||
watched_percent = table.Column<int>(type: "integer", nullable: true)
|
watched_percent = table.Column<int>(type: "integer", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey(
|
table.PrimaryKey(
|
||||||
"pk_episode_watch_status",
|
"pk_episode_watch_status",
|
||||||
x => new { x.user_id, x.episode_id }
|
x => new { x.user_id, x.episode_id }
|
||||||
);
|
);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_episode_watch_status_episodes_episode_id",
|
name: "fk_episode_watch_status_episodes_episode_id",
|
||||||
column: x => x.episode_id,
|
column: x => x.episode_id,
|
||||||
principalTable: "episodes",
|
principalTable: "episodes",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Cascade
|
onDelete: ReferentialAction.Cascade
|
||||||
);
|
);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_episode_watch_status_users_user_id",
|
name: "fk_episode_watch_status_users_user_id",
|
||||||
column: x => x.user_id,
|
column: x => x.user_id,
|
||||||
principalTable: "users",
|
principalTable: "users",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Cascade
|
onDelete: ReferentialAction.Cascade
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "movie_watch_status",
|
name: "movie_watch_status",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
user_id = table.Column<Guid>(type: "uuid", nullable: false),
|
user_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
movie_id = table.Column<Guid>(type: "uuid", nullable: false),
|
movie_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
added_date = table.Column<DateTime>(
|
added_date = table.Column<DateTime>(
|
||||||
type: "timestamp with time zone",
|
type: "timestamp with time zone",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValueSql: "now() at time zone 'utc'"
|
defaultValueSql: "now() at time zone 'utc'"
|
||||||
),
|
),
|
||||||
played_date = table.Column<DateTime>(
|
played_date = table.Column<DateTime>(
|
||||||
type: "timestamp with time zone",
|
type: "timestamp with time zone",
|
||||||
nullable: true
|
nullable: true
|
||||||
),
|
),
|
||||||
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
|
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
|
||||||
watched_time = table.Column<int>(type: "integer", nullable: true),
|
watched_time = table.Column<int>(type: "integer", nullable: true),
|
||||||
watched_percent = table.Column<int>(type: "integer", nullable: true)
|
watched_percent = table.Column<int>(type: "integer", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("pk_movie_watch_status", x => new { x.user_id, x.movie_id });
|
table.PrimaryKey("pk_movie_watch_status", x => new { x.user_id, x.movie_id });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_movie_watch_status_movies_movie_id",
|
name: "fk_movie_watch_status_movies_movie_id",
|
||||||
column: x => x.movie_id,
|
column: x => x.movie_id,
|
||||||
principalTable: "movies",
|
principalTable: "movies",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Cascade
|
onDelete: ReferentialAction.Cascade
|
||||||
);
|
);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_movie_watch_status_users_user_id",
|
name: "fk_movie_watch_status_users_user_id",
|
||||||
column: x => x.user_id,
|
column: x => x.user_id,
|
||||||
principalTable: "users",
|
principalTable: "users",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Cascade
|
onDelete: ReferentialAction.Cascade
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "show_watch_status",
|
name: "show_watch_status",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
user_id = table.Column<Guid>(type: "uuid", nullable: false),
|
user_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
show_id = table.Column<Guid>(type: "uuid", nullable: false),
|
show_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
added_date = table.Column<DateTime>(
|
added_date = table.Column<DateTime>(
|
||||||
type: "timestamp with time zone",
|
type: "timestamp with time zone",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValueSql: "now() at time zone 'utc'"
|
defaultValueSql: "now() at time zone 'utc'"
|
||||||
),
|
),
|
||||||
played_date = table.Column<DateTime>(
|
played_date = table.Column<DateTime>(
|
||||||
type: "timestamp with time zone",
|
type: "timestamp with time zone",
|
||||||
nullable: true
|
nullable: true
|
||||||
),
|
),
|
||||||
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
|
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
|
||||||
unseen_episodes_count = table.Column<int>(type: "integer", nullable: false),
|
unseen_episodes_count = table.Column<int>(type: "integer", nullable: false),
|
||||||
next_episode_id = table.Column<Guid>(type: "uuid", nullable: true),
|
next_episode_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
watched_time = table.Column<int>(type: "integer", nullable: true),
|
watched_time = table.Column<int>(type: "integer", nullable: true),
|
||||||
watched_percent = table.Column<int>(type: "integer", nullable: true)
|
watched_percent = table.Column<int>(type: "integer", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("pk_show_watch_status", x => new { x.user_id, x.show_id });
|
table.PrimaryKey("pk_show_watch_status", x => new { x.user_id, x.show_id });
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_show_watch_status_episodes_next_episode_id",
|
name: "fk_show_watch_status_episodes_next_episode_id",
|
||||||
column: x => x.next_episode_id,
|
column: x => x.next_episode_id,
|
||||||
principalTable: "episodes",
|
principalTable: "episodes",
|
||||||
principalColumn: "id"
|
principalColumn: "id"
|
||||||
);
|
);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_show_watch_status_shows_show_id",
|
name: "fk_show_watch_status_shows_show_id",
|
||||||
column: x => x.show_id,
|
column: x => x.show_id,
|
||||||
principalTable: "shows",
|
principalTable: "shows",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Cascade
|
onDelete: ReferentialAction.Cascade
|
||||||
);
|
);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_show_watch_status_users_user_id",
|
name: "fk_show_watch_status_users_user_id",
|
||||||
column: x => x.user_id,
|
column: x => x.user_id,
|
||||||
principalTable: "users",
|
principalTable: "users",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Cascade
|
onDelete: ReferentialAction.Cascade
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_episode_watch_status_episode_id",
|
name: "ix_episode_watch_status_episode_id",
|
||||||
table: "episode_watch_status",
|
table: "episode_watch_status",
|
||||||
column: "episode_id"
|
column: "episode_id"
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_movie_watch_status_movie_id",
|
name: "ix_movie_watch_status_movie_id",
|
||||||
table: "movie_watch_status",
|
table: "movie_watch_status",
|
||||||
column: "movie_id"
|
column: "movie_id"
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_show_watch_status_next_episode_id",
|
name: "ix_show_watch_status_next_episode_id",
|
||||||
table: "show_watch_status",
|
table: "show_watch_status",
|
||||||
column: "next_episode_id"
|
column: "next_episode_id"
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_show_watch_status_show_id",
|
name: "ix_show_watch_status_show_id",
|
||||||
table: "show_watch_status",
|
table: "show_watch_status",
|
||||||
column: "show_id"
|
column: "show_id"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(name: "episode_watch_status");
|
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
|
migrationBuilder
|
||||||
.AlterDatabase()
|
.AlterDatabase()
|
||||||
.Annotation(
|
.Annotation(
|
||||||
"Npgsql:Enum:genre",
|
"Npgsql:Enum:genre",
|
||||||
"action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western"
|
"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:status", "unknown,finished,airing,planned")
|
||||||
.OldAnnotation(
|
.OldAnnotation(
|
||||||
"Npgsql:Enum:genre",
|
"Npgsql:Enum:genre",
|
||||||
"action,adventure,animation,comedy,crime,documentary,drama,family,fantasy,history,horror,music,mystery,romance,science_fiction,thriller,war,western"
|
"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:status", "unknown,finished,airing,planned")
|
||||||
.OldAnnotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned");
|
.OldAnnotation("Npgsql:Enum:watch_status", "completed,watching,droped,planned");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,27 +2,26 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Settings : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Settings : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.AddColumn<string>(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "settings",
|
||||||
{
|
table: "users",
|
||||||
migrationBuilder.AddColumn<string>(
|
type: "json",
|
||||||
name: "settings",
|
nullable: false,
|
||||||
table: "users",
|
defaultValue: "{}"
|
||||||
type: "json",
|
);
|
||||||
nullable: false,
|
}
|
||||||
defaultValue: "{}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropColumn(name: "settings", table: "users");
|
migrationBuilder.DropColumn(name: "settings", table: "users");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,58 +1,57 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class RuntimeNullable : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class RuntimeNullable : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.AlterColumn<int>(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "runtime",
|
||||||
{
|
table: "movies",
|
||||||
migrationBuilder.AlterColumn<int>(
|
type: "integer",
|
||||||
name: "runtime",
|
nullable: true,
|
||||||
table: "movies",
|
oldClrType: typeof(int),
|
||||||
type: "integer",
|
oldType: "integer"
|
||||||
nullable: true,
|
);
|
||||||
oldClrType: typeof(int),
|
|
||||||
oldType: "integer"
|
|
||||||
);
|
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
migrationBuilder.AlterColumn<int>(
|
||||||
name: "runtime",
|
name: "runtime",
|
||||||
table: "episodes",
|
table: "episodes",
|
||||||
type: "integer",
|
type: "integer",
|
||||||
nullable: true,
|
nullable: true,
|
||||||
oldClrType: typeof(int),
|
oldClrType: typeof(int),
|
||||||
oldType: "integer"
|
oldType: "integer"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.AlterColumn<int>(
|
migrationBuilder.AlterColumn<int>(
|
||||||
name: "runtime",
|
name: "runtime",
|
||||||
table: "movies",
|
table: "movies",
|
||||||
type: "integer",
|
type: "integer",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
oldClrType: typeof(int),
|
oldClrType: typeof(int),
|
||||||
oldType: "integer",
|
oldType: "integer",
|
||||||
oldNullable: true
|
oldNullable: true
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int>(
|
migrationBuilder.AlterColumn<int>(
|
||||||
name: "runtime",
|
name: "runtime",
|
||||||
table: "episodes",
|
table: "episodes",
|
||||||
type: "integer",
|
type: "integer",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
oldClrType: typeof(int),
|
oldClrType: typeof(int),
|
||||||
oldType: "integer",
|
oldType: "integer",
|
||||||
oldNullable: true
|
oldNullable: true
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,34 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class RemoveUserLogo : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class RemoveUserLogo : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.DropColumn(name: "logo_blurhash", table: "users");
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(name: "logo_blurhash", table: "users");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(name: "logo_source", table: "users");
|
migrationBuilder.DropColumn(name: "logo_source", table: "users");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.AddColumn<string>(
|
migrationBuilder.AddColumn<string>(
|
||||||
name: "logo_blurhash",
|
name: "logo_blurhash",
|
||||||
table: "users",
|
table: "users",
|
||||||
type: "character varying(32)",
|
type: "character varying(32)",
|
||||||
maxLength: 32,
|
maxLength: 32,
|
||||||
nullable: true
|
nullable: true
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
migrationBuilder.AddColumn<string>(
|
||||||
name: "logo_source",
|
name: "logo_source",
|
||||||
table: "users",
|
table: "users",
|
||||||
type: "text",
|
type: "text",
|
||||||
nullable: true
|
nullable: true
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,66 +3,65 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddIssues : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddIssues : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.DropForeignKey(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
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(
|
migrationBuilder.CreateTable(
|
||||||
name: "issues",
|
name: "issues",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
domain = table.Column<string>(type: "text", nullable: false),
|
domain = table.Column<string>(type: "text", nullable: false),
|
||||||
cause = table.Column<string>(type: "text", nullable: false),
|
cause = table.Column<string>(type: "text", nullable: false),
|
||||||
reason = table.Column<string>(type: "text", nullable: false),
|
reason = table.Column<string>(type: "text", nullable: false),
|
||||||
extra = table.Column<string>(type: "json", nullable: false),
|
extra = table.Column<string>(type: "json", nullable: false),
|
||||||
added_date = table.Column<DateTime>(
|
added_date = table.Column<DateTime>(
|
||||||
type: "timestamp with time zone",
|
type: "timestamp with time zone",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValueSql: "now() at time zone 'utc'"
|
defaultValueSql: "now() at time zone 'utc'"
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("pk_issues", x => new { x.domain, x.cause });
|
table.PrimaryKey("pk_issues", x => new { x.domain, x.cause });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
migrationBuilder.AddForeignKey(
|
||||||
name: "fk_show_watch_status_episodes_next_episode_id",
|
name: "fk_show_watch_status_episodes_next_episode_id",
|
||||||
table: "show_watch_status",
|
table: "show_watch_status",
|
||||||
column: "next_episode_id",
|
column: "next_episode_id",
|
||||||
principalTable: "episodes",
|
principalTable: "episodes",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.SetNull
|
onDelete: ReferentialAction.SetNull
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropForeignKey(
|
migrationBuilder.DropForeignKey(
|
||||||
name: "fk_show_watch_status_episodes_next_episode_id",
|
name: "fk_show_watch_status_episodes_next_episode_id",
|
||||||
table: "show_watch_status"
|
table: "show_watch_status"
|
||||||
);
|
);
|
||||||
|
|
||||||
migrationBuilder.DropTable(name: "issues");
|
migrationBuilder.DropTable(name: "issues");
|
||||||
|
|
||||||
migrationBuilder.AddForeignKey(
|
migrationBuilder.AddForeignKey(
|
||||||
name: "fk_show_watch_status_episodes_next_episode_id",
|
name: "fk_show_watch_status_episodes_next_episode_id",
|
||||||
table: "show_watch_status",
|
table: "show_watch_status",
|
||||||
column: "next_episode_id",
|
column: "next_episode_id",
|
||||||
principalTable: "episodes",
|
principalTable: "episodes",
|
||||||
principalColumn: "id"
|
principalColumn: "id"
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,21 +2,20 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddPlayPermission : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddPlayPermission : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
// language=PostgreSQL
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
migrationBuilder.Sql(
|
||||||
{
|
"update users set permissions = ARRAY_APPEND(permissions, 'overall.play');"
|
||||||
// language=PostgreSQL
|
);
|
||||||
migrationBuilder.Sql(
|
|
||||||
"update users set permissions = ARRAY_APPEND(permissions, 'overall.play');"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) { }
|
||||||
}
|
}
|
||||||
|
@ -2,27 +2,26 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddUserExternalId : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddUserExternalId : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.AddColumn<string>(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "external_id",
|
||||||
{
|
table: "users",
|
||||||
migrationBuilder.AddColumn<string>(
|
type: "json",
|
||||||
name: "external_id",
|
nullable: false,
|
||||||
table: "users",
|
defaultValue: "{}"
|
||||||
type: "json",
|
);
|
||||||
nullable: false,
|
}
|
||||||
defaultValue: "{}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropColumn(name: "external_id", table: "users");
|
migrationBuilder.DropColumn(name: "external_id", table: "users");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,37 +2,36 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Kyoo.Postgresql.Migrations
|
namespace Kyoo.Postgresql.Migrations;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class MakePasswordOptional : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class MakePasswordOptional : Migration
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
migrationBuilder.AlterColumn<string>(
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
name: "password",
|
||||||
{
|
table: "users",
|
||||||
migrationBuilder.AlterColumn<string>(
|
type: "text",
|
||||||
name: "password",
|
nullable: true,
|
||||||
table: "users",
|
oldClrType: typeof(string),
|
||||||
type: "text",
|
oldType: "text"
|
||||||
nullable: true,
|
);
|
||||||
oldClrType: typeof(string),
|
}
|
||||||
oldType: "text"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.AlterColumn<string>(
|
migrationBuilder.AlterColumn<string>(
|
||||||
name: "password",
|
name: "password",
|
||||||
table: "users",
|
table: "users",
|
||||||
type: "text",
|
type: "text",
|
||||||
nullable: false,
|
nullable: false,
|
||||||
defaultValue: "",
|
defaultValue: "",
|
||||||
oldClrType: typeof(string),
|
oldClrType: typeof(string),
|
||||||
oldType: "text",
|
oldType: "text",
|
||||||
oldNullable: true
|
oldNullable: true
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user