Merge remote-tracking branch 'origin/feat/332-image-categories-pr1' into feat/331-collections-pr1

Keep both features: a duplicate removal moves collection memberships and
copies the image category; both migrations and schema checks run; the
legacy route snapshot now records the six collection routes beside the
image category routes.
This commit is contained in:
Vito Sansevero
2026-10-28 04:34:24 -07:00
24 changed files with 1878 additions and 12 deletions
+11 -2
View File
@@ -38,6 +38,7 @@ from .review_schema import (
review_without_annotations_error,
)
from .saved_views import migrate_saved_views, saved_views_schema_error
from .image_categories import image_categories_schema_error, migrate_image_categories
from .workflow_documents import (
DOCUMENT_ID_COLUMNS,
migrate_workflow_documents,
@@ -355,6 +356,8 @@ class PromptModel:
migrate_annotation_state(conn)
migrate_review_state(conn)
migrate_autotag_state(conn)
# Image categories (#332): independent of every table above.
migrate_image_categories(conn)
# Last: the older generated_images rebuilds run only before file_path.
migrate_workflow_documents(conn)
@@ -1160,8 +1163,9 @@ class PromptModel:
Args:
path: File to inspect
require_library_state: Also require the tables every current
database has (Library state, image favorites, saved views,
collections, image annotations and the review queue), as a migrated
database has (Library state, image favorites, image
categories, saved views, collections, image annotations and
the review queue), as a migrated
restore stage must; old backups may lack them.
documents: Read every workflow document and refuse a damaged
one. A restore checks its upload without it and repairs
@@ -1225,6 +1229,11 @@ class PromptModel:
)
if favorites_error:
return False, favorites_error
categories_error = image_categories_schema_error(
conn, allow_missing=not require_library_state
)
if categories_error:
return False, categories_error
views_error = saved_views_schema_error(
conn, allow_missing=not require_library_state
)