Table: gift_aid_claims
Gift Aid claim batches for HMRC submission, including status and sign-off metadata.
Purpose
Stores one row per Gift Aid claim batch for a church and financial year. The row tracks governance state (draft → ready → signed off → submitted) and timestamps for key milestones.
Relationships
- church_id → churches.id (expected FK; confirm if enforced in your schema dump)
- signed_off_by → users.id (expected FK; nullable)
- Related tables: declarations, donation links, GASDS entries, and tx flags are used to compute claim contents.
Columns
id— surrogate key.church_id— owning church (scope/RBAC boundary).fy_start_year— the financial year start year the claim relates to.status— enum workflow state:DRAFT,READY,SIGNED_OFF,SUBMITTED.signed_off_by— user who signed off the claim (nullable).signed_off_at— timestamp of sign-off (nullable).submitted_at— timestamp when marked submitted (nullable).updated_at— auto-updated timestamp for last change.
Indexes
See DDL below.
Constraints
- Governance invariant: status transitions should be controlled by application rules.
- Uniqueness (recommended): one claim per
(church_id, fy_start_year)if that is your intended model. - Foreign keys (recommended):
church_idandsigned_off_byshould reference their parent tables.
Operational notes / invariants
- Auditability: sign-off and submission events should be recorded to activity/audit logs.
- Immutability expectation: once
SUBMITTED, changes should be blocked or tightly controlled. - Scope: all reads/writes must be church-scoped and RBAC enforced.
DDL
CREATE TABLE `gift_aid_claims` (
`id` int UNSIGNED NOT NULL,
`church_id` int UNSIGNED NOT NULL,
`fy_start_year` int NOT NULL,
`status` enum('DRAFT','READY','SIGNED_OFF','SUBMITTED') NOT NULL DEFAULT 'DRAFT',
`signed_off_by` int UNSIGNED DEFAULT NULL,
`signed_off_at` datetime DEFAULT NULL,
`submitted_at` datetime DEFAULT NULL,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;