Table: gift_aid_church_settings
Per-church configuration used by Gift Aid reporting and HMRC claim outputs.
Purpose
Stores a single row of Gift Aid settings for each church. This includes charity identifiers and toggles used by the Gift Aid module (for example GASDS enablement).
Relationships
- church_id → churches.id (PRIMARY KEY, ON DELETE CASCADE)
Columns
church_id— the church this settings row belongs to (also the primary key).charity_name— optional display name used in outputs (max 255).charity_number— optional charity number (max 80).hmrc_ref— optional HMRC reference (max 80).gasds_enabled— whether GASDS is enabled for this church (default true).updated_at— last update timestamp (auto-updated).
Indexes
- PRIMARY on
church_id(also acts as a “one row per church” constraint)
Constraints
fk_ga_settings_churchFK tochurches.id(ON DELETE CASCADE).
Operational notes / invariants
- Cardinality: one row per church; creation should be controlled by admin/setup flows.
- RBAC: reads should be church-scoped; writes restricted to authorised roles (per governance).
- Privacy: values here may appear on printed/exported reports; avoid personal data.
DDL
CREATE TABLE `gift_aid_church_settings` (
`church_id` int UNSIGNED NOT NULL,
`charity_name` varchar(255) DEFAULT NULL,
`charity_number` varchar(80) DEFAULT NULL,
`hmrc_ref` varchar(80) DEFAULT NULL,
`gasds_enabled` tinyint(1) NOT NULL DEFAULT '1',
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
ALTER TABLE `gift_aid_church_settings`
ADD PRIMARY KEY (`church_id`);
ALTER TABLE `gift_aid_church_settings`
ADD CONSTRAINT `fk_ga_settings_church` FOREIGN KEY (`church_id`) REFERENCES `churches` (`id`) ON DELETE CASCADE;