feat(migration): 0005 — add site_settings_tariff_category_labels table
Some checks failed
CI / Type Check (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
Deploy / Build & Push Image (push) Has been cancelled
Deploy / Deploy to VPS (push) Has been cancelled

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>
This commit is contained in:
Vadym Samoilenko 2026-05-18 13:36:54 +01:00
parent 5ca72de20f
commit f3c3d2c978

View file

@ -0,0 +1,21 @@
-- 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");