mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Merge pull request #293 from BinaryAlley/feature/filter-book-deleted-items-ordering-index
Filters the book deleted-items ordering index by IsDeleted
This commit is contained in:
4 files changed
+3999
-2
No files matched your search
@@ -235,6 +235,8 @@ public class BookConfiguration : IEntityTypeConfiguration<BookEntity>
|
|||||||
builder.HasIndex(book => new { book.LibraryId, book.MetadataStatus });
|
builder.HasIndex(book => new { book.LibraryId, book.MetadataStatus });
|
||||||
// The deleted items page filters by library and deletion state, and orders by the stored deletion time, the title and the Id, so the
|
// The deleted items page filters by library and deletion state, and orders by the stored deletion time, the title and the Id, so the
|
||||||
// index follows the same order and no temporary B-tree is needed for the sort.
|
// index follows the same order and no temporary B-tree is needed for the sort.
|
||||||
builder.HasIndex(book => new { book.LibraryId, book.IsDeleted, book.DeletedOnUtc, book.Title, book.Id });
|
// Only deleted books maintain an entry in the index, since visible books never appear in the listing.
|
||||||
|
builder.HasIndex(book => new { book.LibraryId, book.IsDeleted, book.DeletedOnUtc, book.Title, book.Id })
|
||||||
|
.HasFilter("\"IsDeleted\" = 1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3957
File diff suppressed because it is too large.
Load diff
+37
@@ -0,0 +1,37 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Lumina.DataAccess.Common.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FiltersBookDeletedItemsOrderingIndex : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Books_LibraryId_IsDeleted_DeletedOnUtc_Title_Id",
|
||||||
|
table: "Books");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Books_LibraryId_IsDeleted_DeletedOnUtc_Title_Id",
|
||||||
|
table: "Books",
|
||||||
|
columns: new[] { "LibraryId", "IsDeleted", "DeletedOnUtc", "Title", "Id" },
|
||||||
|
filter: "\"IsDeleted\" = 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Books_LibraryId_IsDeleted_DeletedOnUtc_Title_Id",
|
||||||
|
table: "Books");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Books_LibraryId_IsDeleted_DeletedOnUtc_Title_Id",
|
||||||
|
table: "Books",
|
||||||
|
columns: new[] { "LibraryId", "IsDeleted", "DeletedOnUtc", "Title", "Id" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2117,7 +2117,8 @@ namespace Lumina.DataAccess.Common.Migrations
|
|||||||
b.HasIndex("LibraryId", "Path")
|
b.HasIndex("LibraryId", "Path")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.HasIndex("LibraryId", "IsDeleted", "DeletedOnUtc", "Title", "Id");
|
b.HasIndex("LibraryId", "IsDeleted", "DeletedOnUtc", "Title", "Id")
|
||||||
|
.HasFilter("\"IsDeleted\" = 1");
|
||||||
|
|
||||||
b.ToTable("Books", (string)null);
|
b.ToTable("Books", (string)null);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user