Overview
The Calendar module contains 22 entity tables and 20 relationship tables supporting event management, resource booking, scheduling, and calendar synchronization.Visual Data Model
Core Entity Relationships
Key Relationships Explained
Event Hierarchy:EVENTis the master event (e.g., “Sunday Service”)EVENT_INSTANCEis a specific occurrence (e.g., “Sunday Service on Jan 15, 2024”)EVENT_TIMEbreaks instances into periods (Setup 8am-9am, Event 9am-11am, Teardown 11am-12pm)
RESOURCEs are bookable items (rooms, equipment, vehicles)RESOURCE_FOLDERs organize resources hierarchicallyRESOURCE_BOOKINGlinks resources to event instancesROOM_SETUPdefines different configurations for room resources
EVENT_RESOURCE_REQUESTinitiates booking requestREQUIRED_APPROVALspecifies which groups must approveRESOURCE_APPROVAL_GROUPcontains approversRESOURCE_QUESTIONcollects additional information during booking
CONFLICTtracks resource double-bookings- Links are stored via
calendar_conflicts_relationships - Resolved when winner is selected
EVENT_CONNECTIONlinks calendar events to other Planning Center modules- Connected to Services (worship plans), Groups (group events), etc.
- Enables unified scheduling across the platform
- All inter-entity links are stored in dedicated
*_relationshipstables - Each relationship table holds a parent entity ID,
relationship_type, andrelationship_id
Query Requirements
Schema Prefix
IMPORTANT: All tables in the Planning Center Calendar module are in theplanning_center schema. You MUST prefix all table names with planning_center. in your queries.
✅ CORRECT: SELECT * FROM planning_center.calendar_events
❌ INCORRECT: SELECT * FROM calendar_events
Row Level Security (RLS)
This database uses Row Level Security (RLS) to automatically filter data based on:- tenant_organization_id: You only see data for your current organization
- system_status: You only see ‘active’ records by default
- ❌
WHERE tenant_organization_id = 1(unnecessary) - ❌
WHERE system_status = 'active'(unnecessary)
Core Tables Overview
Primary Entity Tables
calendar_events- Master event definitionscalendar_event_instances- Specific occurrences of eventscalendar_resources- Bookable resources (rooms, equipment)calendar_resource_bookings- Resource reservationscalendar_conflicts- Scheduling conflictscalendar_tags- Event categorizationcalendar_tag_groups- Tag groupings
Supporting Entity Tables
calendar_attachments- File attachments for eventscalendar_event_connections- Links to other PCO modulescalendar_event_resource_requests- Resource booking requestscalendar_event_resource_answers- Answers to booking questionscalendar_event_times- Time blocks within eventscalendar_feeds- Calendar feed configurationscalendar_organizations- Organization settingscalendar_people- People associated with eventscalendar_report_templates- Report templatescalendar_required_approvals- Approval requirementscalendar_resource_approval_groups- Approval groupscalendar_resource_folders- Resource organizationcalendar_resource_questions- Booking questionscalendar_resource_suggestions- Suggested resourcescalendar_room_setups- Room configurations
Relationship Tables
calendar_attachments_relationships- Links attachments to related entitiescalendar_conflicts_relationships- Links conflicts to related entitiescalendar_event_connections_relationships- Links connections to related entitiescalendar_event_resource_answers_relationships- Links answers to related entitiescalendar_event_times_relationships- Links event times to related entitiescalendar_event_instances_relationships- Links instances to related entitiescalendar_event_resource_requests_relationships- Links requests to related entitiescalendar_events_relationships- Links events to related entitiescalendar_feeds_relationships- Links feeds to related entitiescalendar_people_relationships- Links people to related entitiescalendar_required_approvals_relationships- Links required approvals to related entitiescalendar_resource_approval_groups_relationships- Links approval groups to related entitiescalendar_resource_folders_relationships- Links folders to related entitiescalendar_resource_questions_relationships- Links questions to related entitiescalendar_resource_suggestions_relationships- Links suggestions to related entitiescalendar_resource_bookings_relationships- Links bookings to related entitiescalendar_resources_relationships- Links resources to related entitiescalendar_room_setups_relationships- Links room setups to related entitiescalendar_tag_groups_relationships- Links tag groups to related entitiescalendar_tags_relationships- Links tags to related entities
Table Definitions
calendar_events
Master event definitions containing the core event information.calendar_event_instances
Specific occurrences of events, handling both one-time and recurring events.calendar_resources
Bookable resources including rooms, equipment, and other facilities.calendar_resource_bookings
Reservations linking resources to specific events and times.calendar_conflicts
Detected scheduling conflicts between events or resources.calendar_tags
Event categorization labels for organizing and filtering.calendar_tag_groups
Groupings for tags to organize them by ministry, event type, etc.calendar_attachments
File attachments associated with events.calendar_event_connections
Links between calendar events and other Planning Center modules.calendar_event_times
Specific time blocks within event instances (e.g., “Doors Open”, “Main Service”).calendar_room_setups
Predefined room configurations with layout diagrams.calendar_event_resource_requests
Resource requests for events, tracking booking requirements.calendar_event_resource_answers
Answers to resource booking questions.
Note: Relationships (created_by, updated_by, resource_question, event_resource_request) are stored in the
calendar_event_resource_answers_relationships table.
calendar_feeds
Calendar feed configurations for importing and syncing events.calendar_organizations
Organization-wide calendar settings.calendar_people
People with calendar permissions and access.calendar_report_templates
Report templates for calendar data.calendar_required_approvals
Approval requirements for resource bookings.calendar_resource_approval_groups
Groups responsible for approving resource bookings.calendar_resource_folders
Hierarchical organization of resources.calendar_resource_questions
Booking questions for specific resources.calendar_resource_suggestions
Suggested resources for room setups.Relationship Tables
All relationship tables share this structure: a parent entity ID,relationship_type (VARCHAR(50)), and relationship_id (VARCHAR(64)) to identify the related record, plus standard system fields.
calendar_attachments_relationships
Links attachments to related entities (events).calendar_conflicts_relationships
Links conflicts to related entities (resource bookings).calendar_event_connections_relationships
Links event connections to related entities (events).calendar_event_resource_answers_relationships
Links event resource answers to related entities (created_by, updated_by, resource_question, event_resource_request).
Common relationship types:
Person(created_by) - Links to calendar_people (who created the answer)Person(updated_by) - Links to calendar_people (who last updated the answer)ResourceQuestion- Links to calendar_resource_questionsEventResourceRequest- Links to calendar_event_resource_requests
calendar_event_times_relationships
Links event times to related entities (event instances).calendar_event_instances_relationships
Links event instances to event times, resource bookings, and tags.
Common relationship types:
Event- Links to calendar_eventsEventTime- Links to calendar_event_timesResourceBooking- Links to calendar_resource_bookingsTag- Links to calendar_tags
calendar_event_resource_requests_relationships
Links resource requests to answers and bookings.
Common relationship types:
ResourceBooking- Links to calendar_resource_bookingsEventResourceAnswer- Links to calendar_event_resource_answers
calendar_events_relationships
Links events to tags, attachments, and other related entities.
Common relationship types:
Tag- Links to calendar_tagsAttachment- Links to calendar_attachmentsOwner- Links to calendar_people
calendar_feeds_relationships
Links feeds to related entities (event owners).calendar_people_relationships
Links people to related entities.calendar_required_approvals_relationships
Links required approvals to related entities (approval groups, resources).calendar_resource_approval_groups_relationships
Links approval groups to related entities (people, resources).calendar_resource_folders_relationships
Links resource folders to related entities.calendar_resource_questions_relationships
Links resource questions to related entities (resources).calendar_resource_suggestions_relationships
Links resource suggestions to related entities (resources, room setups).calendar_resource_bookings_relationships
Links resource bookings to related entities (events, instances, requests, resources).
Common relationship types:
Event- Links to calendar_eventsEventInstance- Links to calendar_event_instancesEventResourceRequest- Links to calendar_event_resource_requestsResource- Links to calendar_resources
calendar_resources_relationships
Links resources to approval groups, questions, and room setups.
Common relationship types:
ResourceApprovalGroup- Links to calendar_resource_approval_groupsResourceQuestion- Links to calendar_resource_questionsRoomSetup- Links to calendar_room_setups
calendar_room_setups_relationships
Links room setups to related entities (containing resource, associated room setup).calendar_tag_groups_relationships
Links tag groups to related entities.calendar_tags_relationships
Links tags to related entities (tag groups).System Fields
All tables include these system fields for data management:tenant_organization_id- Multi-tenant organization identifiersystem_status- Data lifecycle status:transferring- Being imported from Planning Centeractive- Current active datastale- Marked for removal
system_created_at- When record was created in Parablesystem_updated_at- When record was last updated in Parable
Common Query Patterns
Getting Events with Tags
Finding Available Resources
Detecting Booking Conflicts
Today’s Schedule
Data Integrity Rules
- Schema Qualification: Always use
planning_center.prefix for all table references - Row Level Security: RLS automatically handles multi-tenancy and status filtering - do not add manual filters
- Monetary Values: Resource fee and cost columns are stored in cents - divide by 100.0 for display
- Time Windows: Use
starts_at/ends_atcomparisons and theall_day_eventflag rather than relying onsystem_status - Relationship Tables: All inter-entity links are stored in
*_relationshipstables — never in direct columns on the entity tables
Common Mistakes to Avoid
-
Missing Schema Prefix
- ❌
FROM calendar_events - ✅
FROM planning_center.calendar_events
- ❌
-
Adding Redundant RLS Filters
- ❌
WHERE tenant_organization_id = 1 AND system_status = 'active' - ✅ Trust RLS to handle this automatically
- ❌
-
Joining Without Schema
- ❌
JOIN calendar_resource_bookings rb ON ... - ✅
JOIN planning_center.calendar_resource_bookings rb ON ...
- ❌
-
Using the wrong parent column in relationship tables
- ❌
WHERE event_resource_request_id = ...incalendar_event_resource_requests_relationships - ✅
WHERE event_resource_request_id = ...(the live column isevent_resource_request_id)
- ❌
-
Using the wrong parent column in eventinstances relationship table
- ❌
WHERE event_instance_id = ...incalendar_event_instances_relationships - ✅
WHERE event_instance_id = ...(the live column isevent_instance_id)
- ❌
Performance Considerations
-
Indexes: All tables have optimized indexes on:
- Primary keys and entity IDs
- Join columns and foreign keys
- Date columns for time-based queries
-
Query Optimization:
- Always use the
planning_center.schema prefix - RLS handles tenant and status filtering automatically
- Filter by approval or conflict flags when relevant
- Consider CTEs for complex hierarchical queries
- Use relationship tables for all cross-entity joins
- Always use the
Data Types and Conventions
Approval Statuses
A- ApprovedP- Pending approvalR- RejectedNULL- No approval required
Resource Types (kind)
Room- Physical spacesResource- Other bookable items (equipment, etc.)
All-Day Events
all_day_event = trueindicates full-day events- Check date portions of
starts_atandends_at - May span multiple days
Recurrence Patterns
recurrenceholds a single keyword, not an iCal RRULE:'None','Daily','Weekly','Monthly','Yearly','CustomDates','YearMonth', or'MonthDay'. It is never NULL — filter withrecurrence <> 'None'to select recurring events- Human-readable detail (days, times, start and end dates) is in
recurrence_description, also never NULL - Each occurrence is a separate event_instance
Next Steps
- Start with Basic Queries for simple examples
- Progress to Advanced Queries for complex analysis
- Use Reporting Examples for production reports
- Return to Overview for overview