Migrate to dotnet8

This commit is contained in:
Zoe Roux 2024-03-23 00:34:56 +01:00
parent 5fedce71a0
commit 5a461bca7d
No known key found for this signature in database
19 changed files with 900 additions and 941 deletions

View File

@ -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

View File

@ -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

View File

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>preview</LangVersion>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>default</LangVersion>
<Company>Kyoo</Company>
<Authors>Kyoo</Authors>
<Copyright>Copyright (c) Kyoo</Copyright>

View File

@ -17,7 +17,6 @@
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
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.
/// </summary>
[Serializable]
public class DuplicatedItemException : Exception
public class DuplicatedItemException(object? existing = null) : Exception("Already exists in the database.")
{
/// <summary>
/// The existing object.
/// </summary>
public object? Existing { get; }
/// <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) { }
public object? Existing { get; } = existing;
}

View File

@ -17,7 +17,6 @@
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
using System;
using System.Runtime.Serialization;
namespace Kyoo.Abstractions.Models.Exceptions;
@ -39,12 +38,4 @@ public class ItemNotFoundException : Exception
/// <param name="message">The message of the exception</param>
public ItemNotFoundException(string 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) { }
}

View File

@ -17,7 +17,6 @@
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
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) { }
}

View File

@ -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);
}

View File

@ -74,10 +74,10 @@ public class CrudThumbsApi<T> : CrudApi<T>
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);
}

View File

@ -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);
}

File diff suppressed because it is too large Load Diff

View File

@ -22,203 +22,202 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kyoo.Postgresql.Migrations
namespace Kyoo.Postgresql.Migrations;
/// <inheritdoc />
public partial class Watchlist : Migration
{
/// <inheritdoc />
public partial class Watchlist : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
/// <inheritdoc />
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<Guid>(type: "uuid", nullable: false),
episode_id = table.Column<Guid>(type: "uuid", nullable: false),
added_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: false,
defaultValueSql: "now() at time zone 'utc'"
),
played_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: true
),
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
watched_time = table.Column<int>(type: "integer", nullable: true),
watched_percent = table.Column<int>(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<Guid>(type: "uuid", nullable: false),
episode_id = table.Column<Guid>(type: "uuid", nullable: false),
added_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: false,
defaultValueSql: "now() at time zone 'utc'"
),
played_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: true
),
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
watched_time = table.Column<int>(type: "integer", nullable: true),
watched_percent = table.Column<int>(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<Guid>(type: "uuid", nullable: false),
movie_id = table.Column<Guid>(type: "uuid", nullable: false),
added_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: false,
defaultValueSql: "now() at time zone 'utc'"
),
played_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: true
),
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
watched_time = table.Column<int>(type: "integer", nullable: true),
watched_percent = table.Column<int>(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<Guid>(type: "uuid", nullable: false),
movie_id = table.Column<Guid>(type: "uuid", nullable: false),
added_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: false,
defaultValueSql: "now() at time zone 'utc'"
),
played_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: true
),
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
watched_time = table.Column<int>(type: "integer", nullable: true),
watched_percent = table.Column<int>(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<Guid>(type: "uuid", nullable: false),
show_id = table.Column<Guid>(type: "uuid", nullable: false),
added_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: false,
defaultValueSql: "now() at time zone 'utc'"
),
played_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: true
),
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
unseen_episodes_count = table.Column<int>(type: "integer", nullable: false),
next_episode_id = table.Column<Guid>(type: "uuid", nullable: true),
watched_time = table.Column<int>(type: "integer", nullable: true),
watched_percent = table.Column<int>(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<Guid>(type: "uuid", nullable: false),
show_id = table.Column<Guid>(type: "uuid", nullable: false),
added_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: false,
defaultValueSql: "now() at time zone 'utc'"
),
played_date = table.Column<DateTime>(
type: "timestamp with time zone",
nullable: true
),
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
unseen_episodes_count = table.Column<int>(type: "integer", nullable: false),
next_episode_id = table.Column<Guid>(type: "uuid", nullable: true),
watched_time = table.Column<int>(type: "integer", nullable: true),
watched_percent = table.Column<int>(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"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "episode_watch_status");
/// <inheritdoc />
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");
}
}

View File

@ -2,27 +2,26 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kyoo.Postgresql.Migrations
namespace Kyoo.Postgresql.Migrations;
/// <inheritdoc />
public partial class Settings : Migration
{
/// <inheritdoc />
public partial class Settings : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "settings",
table: "users",
type: "json",
nullable: false,
defaultValue: "{}"
);
}
migrationBuilder.AddColumn<string>(
name: "settings",
table: "users",
type: "json",
nullable: false,
defaultValue: "{}"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(name: "settings", table: "users");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(name: "settings", table: "users");
}
}

View File

@ -1,58 +1,57 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kyoo.Postgresql.Migrations
namespace Kyoo.Postgresql.Migrations;
/// <inheritdoc />
public partial class RuntimeNullable : Migration
{
/// <inheritdoc />
public partial class RuntimeNullable : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "runtime",
table: "movies",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer"
);
migrationBuilder.AlterColumn<int>(
name: "runtime",
table: "movies",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer"
);
migrationBuilder.AlterColumn<int>(
name: "runtime",
table: "episodes",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer"
);
}
migrationBuilder.AlterColumn<int>(
name: "runtime",
table: "episodes",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "runtime",
table: "movies",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true
);
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "runtime",
table: "movies",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true
);
migrationBuilder.AlterColumn<int>(
name: "runtime",
table: "episodes",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true
);
}
migrationBuilder.AlterColumn<int>(
name: "runtime",
table: "episodes",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true
);
}
}

View File

@ -1,35 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Kyoo.Postgresql.Migrations
namespace Kyoo.Postgresql.Migrations;
/// <inheritdoc />
public partial class RemoveUserLogo : Migration
{
/// <inheritdoc />
public partial class RemoveUserLogo : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
/// <inheritdoc />
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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "logo_blurhash",
table: "users",
type: "character varying(32)",
maxLength: 32,
nullable: true
);
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "logo_blurhash",
table: "users",
type: "character varying(32)",
maxLength: 32,
nullable: true
);
migrationBuilder.AddColumn<string>(
name: "logo_source",
table: "users",
type: "text",
nullable: true
);
}
migrationBuilder.AddColumn<string>(
name: "logo_source",
table: "users",
type: "text",
nullable: true
);
}
}

View File

@ -3,66 +3,65 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kyoo.Postgresql.Migrations
namespace Kyoo.Postgresql.Migrations;
/// <inheritdoc />
public partial class AddIssues : Migration
{
/// <inheritdoc />
public partial class AddIssues : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
/// <inheritdoc />
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<string>(type: "text", nullable: false),
cause = table.Column<string>(type: "text", nullable: false),
reason = table.Column<string>(type: "text", nullable: false),
extra = table.Column<string>(type: "json", nullable: false),
added_date = table.Column<DateTime>(
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<string>(type: "text", nullable: false),
cause = table.Column<string>(type: "text", nullable: false),
reason = table.Column<string>(type: "text", nullable: false),
extra = table.Column<string>(type: "json", nullable: false),
added_date = table.Column<DateTime>(
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
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_show_watch_status_episodes_next_episode_id",
table: "show_watch_status"
);
/// <inheritdoc />
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"
);
}
}

View File

@ -2,21 +2,20 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kyoo.Postgresql.Migrations
namespace Kyoo.Postgresql.Migrations;
/// <inheritdoc />
public partial class AddPlayPermission : Migration
{
/// <inheritdoc />
public partial class AddPlayPermission : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// language=PostgreSQL
migrationBuilder.Sql(
"update users set permissions = ARRAY_APPEND(permissions, 'overall.play');"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) { }
// language=PostgreSQL
migrationBuilder.Sql(
"update users set permissions = ARRAY_APPEND(permissions, 'overall.play');"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) { }
}

View File

@ -2,27 +2,26 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kyoo.Postgresql.Migrations
namespace Kyoo.Postgresql.Migrations;
/// <inheritdoc />
public partial class AddUserExternalId : Migration
{
/// <inheritdoc />
public partial class AddUserExternalId : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "external_id",
table: "users",
type: "json",
nullable: false,
defaultValue: "{}"
);
}
migrationBuilder.AddColumn<string>(
name: "external_id",
table: "users",
type: "json",
nullable: false,
defaultValue: "{}"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(name: "external_id", table: "users");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(name: "external_id", table: "users");
}
}

View File

@ -2,37 +2,36 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Kyoo.Postgresql.Migrations
namespace Kyoo.Postgresql.Migrations;
/// <inheritdoc />
public partial class MakePasswordOptional : Migration
{
/// <inheritdoc />
public partial class MakePasswordOptional : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "password",
table: "users",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text"
);
}
migrationBuilder.AlterColumn<string>(
name: "password",
table: "users",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text"
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "password",
table: "users",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true
);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "password",
table: "users",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true
);
}
}

View File

@ -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