Church Cashbook
Data Schema Manual
Manual home Return to Church Cashbook

Table: gift_aid_gasds_entries

GASDS register entries (small donations) recorded separately from the main transactions ledger.

Purpose

Stores individual GASDS entries for a church, including date, payment method (cash/contactless), eligibility tracking, and optional reference text. These entries support Gift Aid claims and reporting.

Relationships

Columns

Indexes

Constraints

Operational notes / invariants

DDL

CREATE TABLE `gift_aid_gasds_entries` (
  `id` int UNSIGNED NOT NULL,
  `church_id` int UNSIGNED NOT NULL,
  `entry_date` date NOT NULL,
  `method` enum('cash','contactless') NOT NULL DEFAULT 'cash',
  `amount` decimal(12,2) NOT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `is_eligible` tinyint(1) NOT NULL DEFAULT '1',
  `ineligible_reason` varchar(255) DEFAULT NULL,
  `created_by` int UNSIGNED DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

ALTER TABLE `gift_aid_gasds_entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_ga_gasds_church_date` (`church_id`,`entry_date`),
  ADD KEY `fk_ga_gasds_user` (`created_by`);

ALTER TABLE `gift_aid_gasds_entries`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT;

ALTER TABLE `gift_aid_gasds_entries`
  ADD CONSTRAINT `fk_ga_gasds_church` FOREIGN KEY (`church_id`) REFERENCES `churches` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_ga_gasds_user` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;