Church Cashbook Data Schema Manual
Church identity and scope root for financial records.
Purpose
The churches table is the scope anchor for most financial data. Nearly all user-facing records (transactions, categories, opening balances, budgets, Gift Aid settings) are ultimately attached to a church.
Columns
- id (PK) — internal church identifier.
- deanery_id (FK → deaneries.id) — groups churches into deaneries (used for deanery-scope RBAC and reporting).
- name — church name (display label).
- location — optional reference location/address string (used in reports).
- fy_start_month, fy_start_day — financial year start.
- fy_end_month, fy_end_day — financial year end.
- bank_account_id — optional default bank account for this church (governance-controlled in UI; FK not declared here).
- is_active — active flag; dormant churches should not be selectable for normal entry.
Indexes
- PRIMARY KEY (
id) - idx_church_deanery (
deanery_id) — supports deanery grouping and deanery-scope operations.
Constraints
- fk_churches_deaneries — ensures every church belongs to a valid deanery.
Operational notes
- RBAC:
church_idis the fundamental scoping value used throughout the system; cross-church access must be prevented at query and handler level. - Financial year: FY start/end are stored per church; reports should derive FY boundaries from these fields (or from a globally enforced FY rule, if used).
- Bank governance:
bank_account_idindicates the primary bank account; changes should be governed and logged. - Dormancy:
is_activeallows a church to be retired from normal selection without deleting records.