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
All checks were successful
Deploy production / deploy (push) Successful in 1m11s
This commit is contained in:
28
drizzle/20261025141516_books_archive/migration.sql
Normal file
28
drizzle/20261025141516_books_archive/migration.sql
Normal 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 $$;
|
||||
Reference in New Issue
Block a user