From f3c3d2c9789d52ddc0796ef8051a3ff27d0fca3d Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Mon, 18 May 2026 13:36:54 +0100 Subject: [PATCH] =?UTF-8?q?feat(migration):=200005=20=E2=80=94=20add=20sit?= =?UTF-8?q?e=5Fsettings=5Ftariff=5Fcategory=5Flabels=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../0005_site_settings_tariff_labels.sql | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 migrations/0005_site_settings_tariff_labels.sql diff --git a/migrations/0005_site_settings_tariff_labels.sql b/migrations/0005_site_settings_tariff_labels.sql new file mode 100644 index 0000000..4f38c20 --- /dev/null +++ b/migrations/0005_site_settings_tariff_labels.sql @@ -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");