mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Adds book deletion and restore to the web client.
Soft deletes books so the scan keeps their paths reserved, lists the deleted books on a themed page, and lets the user restore them. Updates the API, bundled themes, localization, documentation and tests. Closes #213
This commit is contained in:
1 parent
ef5ede6325
commit
f26b07d4ff
125 files changed
+9856
-378
No files matched your search
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lumina.DataAccess.Common.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddsBookDeletionState : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "DeletedOnUtc",
|
||||
table: "Books",
|
||||
type: "TEXT",
|
||||
nullable: true)
|
||||
.Annotation("Relational:ColumnOrder", 42);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsDeleted",
|
||||
table: "Books",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false)
|
||||
.Annotation("Relational:ColumnOrder", 41);
|
||||
|
||||
// This migration introduces both deletion columns together, so a database coming from an older schema has no deleted books to backfill.
|
||||
// The statement is kept for databases that were created by an intermediate build that already had IsDeleted.
|
||||
migrationBuilder.Sql("""
|
||||
UPDATE Books
|
||||
SET DeletedOnUtc = COALESCE(UpdatedOnUtc, CreatedOnUtc)
|
||||
WHERE IsDeleted = 1 AND DeletedOnUtc IS NULL;
|
||||
""");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Books_LibraryId_IsDeleted_DeletedOnUtc_Title_Id",
|
||||
table: "Books",
|
||||
columns: new[] { "LibraryId", "IsDeleted", "DeletedOnUtc", "Title", "Id" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Books_LibraryId_IsDeleted_DeletedOnUtc_Title_Id",
|
||||
table: "Books");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DeletedOnUtc",
|
||||
table: "Books");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsDeleted",
|
||||
table: "Books");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user