Shumiland/migrations/0013_section_visibility.sql
Vadym Samoilenko 7371462eab
Some checks are pending
CI / Type Check (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Unit Tests (push) Waiting to run
Deploy / Build & Push Image (push) Waiting to run
Deploy / Deploy to VPS (push) Blocked by required conditions
fix(migration): add _home_page_v_version_sections table for versions support
2026-06-05 12:31:41 +01:00

29 lines
1.3 KiB
SQL

-- 0013: homepage sections array — ordering, visibility, add/remove
-- Live table (varchar id — Payload generates string IDs)
CREATE TABLE IF NOT EXISTS "home_page_sections" (
"_order" integer NOT NULL,
"_parent_id" integer NOT NULL REFERENCES "home_page"("id") ON DELETE CASCADE,
"id" character varying NOT NULL,
"type" character varying,
"enabled" boolean DEFAULT true,
CONSTRAINT "home_page_sections_pkey" PRIMARY KEY ("id")
);
CREATE INDEX IF NOT EXISTS "home_page_sections_order_idx"
ON "home_page_sections" ("_order");
CREATE INDEX IF NOT EXISTS "home_page_sections_parent_id_idx"
ON "home_page_sections" ("_parent_id");
-- Versions table (serial id + _uuid — mirrors _home_page_v_version_faq_items pattern)
CREATE TABLE IF NOT EXISTS "_home_page_v_version_sections" (
"_order" integer NOT NULL,
"_parent_id" integer NOT NULL REFERENCES "_home_page_v"("id") ON DELETE CASCADE,
"id" serial PRIMARY KEY,
"type" character varying,
"enabled" boolean DEFAULT true,
"_uuid" character varying
);
CREATE INDEX IF NOT EXISTS "_home_page_v_version_sections_order_idx"
ON "_home_page_v_version_sections" ("_order");
CREATE INDEX IF NOT EXISTS "_home_page_v_version_sections_parent_id_idx"
ON "_home_page_v_version_sections" ("_parent_id");