Church Cashbook
Data Schema Manual
Manual home Return to Church Cashbook

Church Cashbook Data Schema Manual

Links transactions to declarations for eligibility.

DDL required: Paste the CREATE TABLE (plus indexes and constraints) for gift_aid_donation_links so this page can be completed accurately.

Purpose

TODO — will be completed once DDL is provided.

Key columns

Constraints & invariants

Operational notes

Optional diagram placeholder: relationships around gift_aid_donation_links

Relationships

To be completed.

Columns

See DDL below.

Indexes

See DDL below.

Constraints

See DDL below.

Operational notes / invariants

DDL

-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Feb 25, 2026 at 12:14 PM
-- Server version: 8.0.40
-- PHP Version: 8.3.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `church_accounts`
--

-- --------------------------------------------------------

--
-- Table structure for table `gift_aid_donation_links`
--

CREATE TABLE `gift_aid_donation_links` (
  `id` int UNSIGNED NOT NULL,
  `transaction_id` int UNSIGNED NOT NULL,
  `declaration_id` int UNSIGNED NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `gift_aid_donation_links`
--
ALTER TABLE `gift_aid_donation_links`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `ux_ga_link_tx` (`transaction_id`),
  ADD KEY `idx_ga_link_decl` (`declaration_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `gift_aid_donation_links`
--
ALTER TABLE `gift_aid_donation_links`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `gift_aid_donation_links`
--
ALTER TABLE `gift_aid_donation_links`
  ADD CONSTRAINT `fk_ga_link_decl` FOREIGN KEY (`declaration_id`) REFERENCES `gift_aid_declarations` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `fk_ga_link_tx` FOREIGN KEY (`transaction_id`) REFERENCES `transactions` (`id`) ON DELETE CASCADE;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;