29 lines
1.3 KiB
SQL
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");
|