fix: harden production flows and user messaging

This commit is contained in:
Leon Tonhäuser committed 2026-08-11 16:07:13 +02:00
1 parent 52dce168dd
commit 86dfe8053d
43 files changed
+3520 -358

No files matched your search

@@ -1,32 +0,0 @@
-- 1. Create the album_auto_rules table
CREATE TABLE IF NOT EXISTS "album_auto_rules" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"editorial_account_id" uuid NOT NULL,
"keyword" text NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"created_by_user_id" uuid
);
DO $$ BEGIN
ALTER TABLE "album_auto_rules" ADD CONSTRAINT "album_auto_rules_editorial_account_id_editorial_accounts_id_fk" FOREIGN KEY ("editorial_account_id") REFERENCES "public"."editorial_accounts"("id") ON DELETE restrict ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
DO $$ BEGIN
ALTER TABLE "album_auto_rules" ADD CONSTRAINT "album_auto_rules_created_by_user_id_users_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
CREATE UNIQUE INDEX IF NOT EXISTS "album_auto_rules_editorial_account_id_keyword_idx" ON "album_auto_rules" ("editorial_account_id", lower("keyword"));
-- 2. Add archived_at and archived_by_user_id to editorial_accounts
ALTER TABLE "editorial_accounts" ADD COLUMN "archived_at" timestamp with time zone;
ALTER TABLE "editorial_accounts" ADD COLUMN "archived_by_user_id" uuid;
DO $$ BEGIN
ALTER TABLE "editorial_accounts" ADD CONSTRAINT "editorial_accounts_archived_by_user_id_users_id_fk" FOREIGN KEY ("archived_by_user_id") REFERENCES "public"."users"("id") ON DELETE restrict ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
+1
View File
@@ -0,0 +1 @@
CREATE INDEX "usages_created_at_idx" ON "usages" USING btree ("created_at");
File diff suppressed because it is too large. Load diff
+8 -1
View File
@@ -64,6 +64,13 @@
"when": 1786411419497,
"tag": "0008_overjoyed_wrecking_crew",
"breakpoints": true
},
{
"idx": 9,
"version": "7",
"when": 1786455754414,
"tag": "0009_usage_created_at_index",
"breakpoints": true
}
]
}
}