reading: owner archive / restore / delete / merge for books (⋯ menu on cards, rows and detail pages), archived filter, tombstones so merged ids redirect and the ingest never recreates deleted works, books-quarantine.py for deleted files
All checks were successful
Deploy production / deploy (push) Successful in 1m11s

This commit is contained in:
2026-10-25 14:22:40 +00:00
parent 8a8ed1642e
commit 27987fb8e7
17 changed files with 27812 additions and 28 deletions

View File

@@ -0,0 +1,28 @@
CREATE TABLE "books"."deleted_works" (
"id" integer PRIMARY KEY,
"title" text NOT NULL,
"authors" text[] DEFAULT '{}'::text[] NOT NULL,
"isbn13" text,
"annas_md5" text[] DEFAULT '{}'::text[] NOT NULL,
"file_sha256" text[] DEFAULT '{}'::text[] NOT NULL,
"file_paths" text[] DEFAULT '{}'::text[] NOT NULL,
"source_refs" jsonb DEFAULT '{}' NOT NULL,
"merged_into" integer,
"deleted_at" timestamp with time zone DEFAULT now() NOT NULL,
"quarantined_at" timestamp with time zone
);
--> statement-breakpoint
ALTER TABLE "books"."works" ADD COLUMN "archived_at" timestamp with time zone;--> statement-breakpoint
CREATE INDEX "deleted_works_merged_into_idx" ON "books"."deleted_works" ("merged_into");--> statement-breakpoint
CREATE INDEX "works_archived_at_idx" ON "books"."works" ("archived_at");--> statement-breakpoint
ALTER TABLE "books"."deleted_works" ADD CONSTRAINT "deleted_works_merged_into_works_id_fkey" FOREIGN KEY ("merged_into") REFERENCES "books"."works"("id") ON DELETE SET NULL;--> statement-breakpoint
-- Hand-written: explicit grants (default privileges from the books migration cover new tables too).
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'personal_app') THEN
GRANT SELECT, INSERT, UPDATE, DELETE ON books.deleted_works TO personal_app;
END IF;
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'personal_ro') THEN
GRANT SELECT ON books.deleted_works TO personal_ro;
END IF;
END $$;

File diff suppressed because it is too large Load Diff