Sub-table for the tariffCategoryLabels array field added to SiteSettings global. Was missing from prod DB causing query failures on every page load. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
964 B
SQL
21 lines
964 B
SQL
-- Migration 0005: site_settings_tariff_category_labels sub-table
|
|
-- Added when tariffCategoryLabels array field was added to SiteSettings global
|
|
|
|
CREATE TABLE IF NOT EXISTS "site_settings_tariff_category_labels" (
|
|
"_order" integer NOT NULL,
|
|
"_parent_id" integer NOT NULL,
|
|
"id" varchar PRIMARY KEY NOT NULL,
|
|
"key" varchar NOT NULL,
|
|
"label" varchar NOT NULL
|
|
);
|
|
|
|
DO $$ BEGIN
|
|
ALTER TABLE "site_settings_tariff_category_labels" ADD CONSTRAINT "site_settings_tariff_category_labels_parent_id_fk"
|
|
FOREIGN KEY ("_parent_id") REFERENCES "public"."site_settings"("id") ON DELETE cascade ON UPDATE no action;
|
|
EXCEPTION WHEN duplicate_object THEN null; END $$;
|
|
|
|
CREATE INDEX IF NOT EXISTS "site_settings_tariff_category_labels_order_idx"
|
|
ON "site_settings_tariff_category_labels" USING btree ("_order");
|
|
|
|
CREATE INDEX IF NOT EXISTS "site_settings_tariff_category_labels_parent_id_idx"
|
|
ON "site_settings_tariff_category_labels" USING btree ("_parent_id");
|