Database Schema

Complete database structure documentation for developers and DBAs

Database Overview

MaxChurches uses MySQL 8.0+ with utf8mb4 character set for full Unicode support. The database is designed with proper normalization and relationships to ensure data integrity and performance.

Database Engine
MySQL 8.0+
Character Set
utf8mb4
Storage Engine
InnoDB
Tables
50+
Database Design: The database follows Laravel conventions with proper foreign key relationships, indexes for performance, and soft deletes for data integrity.

Core Tables

The main database tables that power MaxChurches functionality.

Table Name Purpose Relationships
churches Church organization data One-to-many with users, members
users System user accounts Belongs to church
members Church member profiles Belongs to church, has many attendance
services Church service scheduling Belongs to church, has many attendance
attendance Attendance tracking Belongs to member and service
church_transactions Financial transactions Belongs to member and money_type
church_events Church events and activities Belongs to church, has many registrations

Database Relationships

Understanding the relationships between tables is crucial for effective querying and data integrity.

Primary Relationships
  • Churches → Users: One church has many users
  • Churches → Members: One church has many members
  • Members → Attendance: One member has many attendance records
  • Services → Attendance: One service has many attendance records
Foreign Key Constraints
  • CASCADE on church deletion
  • SET NULL on user deletion
  • RESTRICT on referenced records
  • Automatic cleanup of orphaned data

Performance Optimization

Database indexes and optimization techniques for better performance.

Note: All indexes are automatically created during migration. Manual optimization may be needed for large datasets.
Primary Indexes
  • idx_members_search - Member name and email search
  • idx_attendance_date - Attendance by date
  • idx_church_transactions_date - Financial transactions by date
  • idx_church_events_date - Events by date and status
Query Optimization
  • Use proper WHERE clauses with indexed columns
  • Limit result sets with LIMIT and pagination
  • Avoid SELECT * in production queries
  • Use JOINs instead of subqueries when possible
Download Database Schema

Download this database schema documentation as a PDF for offline reference.

Database Support

Need help with database optimization or custom queries? Our DBA team can assist you.