Organization cards: list partners, ministries or a hand-picked set (migration 067)

The Partners section's preset gets "Cards: list" (partners by default,
ministries, or both) and an optional hand-picked list
(page_section_orgs, partners or ministries only, enforced by trigger)
that replaces it in its own order. /organizations takes kind=ministry
and ids=; the plain list still leaves ministries out. Ministry cards
link to their website only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-04 22:40:24 -05:00
parent 635dd21083
commit fd7e1b6fc1
11 changed files with 146 additions and 23 deletions

View file

@ -0,0 +1,42 @@
-- ═══════════════════════════════════════════════════════════════
-- 067 ORGANIZATION CARDS: WHICH ORGANIZATIONS
--
-- The organization cards preset (page_sections.preset 'partner_list',
-- the Community page's Partners) can list ministries as well as
-- partners, chosen two ways:
--
-- page_sections.org_kinds which kinds it lists by itself, every
-- published, listed one by name:
-- 'partner', 'ministry' or both
-- ('partner,ministry'). Blank: partners
-- page_section_orgs a hand-picked list, in order; when a
-- section has any, it shows those instead
-- (published ones, listed or not). Only
-- partners and ministries (triggers below)
-- ═══════════════════════════════════════════════════════════════
ALTER TABLE page_sections ADD COLUMN org_kinds TEXT
CHECK (org_kinds IN ('partner', 'ministry', 'partner,ministry'));
CREATE TABLE page_section_orgs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
section_id INTEGER NOT NULL REFERENCES page_sections (id) ON DELETE CASCADE,
sort_order INTEGER NOT NULL DEFAULT 0,
org_id TEXT NOT NULL REFERENCES organizations (id) ON DELETE CASCADE
) STRICT;
CREATE INDEX page_section_orgs_section_idx ON page_section_orgs (section_id, sort_order);
CREATE TRIGGER page_section_orgs_kind
BEFORE INSERT ON page_section_orgs
FOR EACH ROW WHEN (SELECT kind FROM organizations WHERE id = new.org_id) NOT IN ('partner', 'ministry')
BEGIN
SELECT RAISE(ABORT, 'Organization cards can list partners and ministries only.');
END;
CREATE TRIGGER page_section_orgs_kind_update
BEFORE UPDATE OF org_id ON page_section_orgs
FOR EACH ROW WHEN (SELECT kind FROM organizations WHERE id = new.org_id) NOT IN ('partner', 'ministry')
BEGIN
SELECT RAISE(ABORT, 'Organization cards can list partners and ministries only.');
END;