Overview
The Publishing module manages your church’s media content distribution, containing:- 13 entity tables - Episodes, series, channels, speakers, and supporting data
- 4 relationship tables - Linking episodes, channels, series, and speakerships to related entities
- Comprehensive metrics - View counts, downloads, and engagement tracking
Visual Data Model
Core Entity Relationships
Key Relationships Explained
Content Hierarchy:CHANNELis the top-level podcast/media feedSERIESorganizes episodes by topic or themeEPISODEis the individual sermon, message, or content piece- Hierarchy: Channel → Series → Episode
CHANNEL_DEFAULT_TIMEdefines recurring publish scheduleCHANNEL_NEXT_TIMEoverrides next publish date/timeEPISODE_TIMEtracks when specific episodes were/will be published- Supports both recurring schedules and one-off publications
EPISODE_RESOURCEstores multiple formats per episode- Kinds include: audio, video, PDF notes, etc.
- Each resource has URL and file size tracking
- Single episode can have audio, video, and supplementary files
SPEAKERdefines individuals who present contentSPEAKERSHIPlinks episodes to speakers (many-to-many)- Single episode can have multiple speakers
- Speakers can appear in multiple episodes/series
EPISODE_STATISTICtracks engagement metrics- Metrics: library watch count, live watch count, time periods
- Historical tracking with date ranges
- Enables trend analysis and content performance review
NOTE_TEMPLATEprovides reusable sermon note formatsORGANIZATIONlinks to Planning Center organization settings
- Inter-entity links are stored in
*_relationshipstables - Each relationship table holds a parent entity ID,
relationship_type, andrelationship_id - Episode times, episode resources, and channel times belong to their parent via relationship tables
Query Requirements
Schema Prefix
IMPORTANT: All tables in the Planning Center Publishing module are in theplanning_center schema. You MUST prefix all table names with planning_center. in your queries.
✅ CORRECT: SELECT * FROM planning_center.publishing_episodes
❌ INCORRECT: SELECT * FROM publishing_episodes
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)
Complete Table Inventory
Core Content Tables
1. publishing_episodes
Individual sermons, messages, and content pieces.
2. publishing_series
Sermon series and content collections.
3. publishing_channels
Distribution channels and platforms.
4. publishing_speakers
Speaker profiles and information.
Relationship Tables
5. publishing_speakerships
Links episodes to speakers (junction table).
Resource and Media Tables
6. publishing_episode_resources
Files and resources attached to episodes.
7. publishing_note_templates
Templates for sermon notes and outlines.
Scheduling Tables
8. publishing_episode_times
Publishing schedule for episodes on different channels.
9. publishing_channel_default_times
Default publishing schedules per channel.
10. publishing_channel_next_times
Upcoming scheduled publishes per channel.
Analytics Tables
11. publishing_episode_statistics
View counts, downloads, and engagement metrics.
12. publishing_episode_statistic_times
Statistics tracked over time periods.
Configuration Tables
13. publishing_organizations
Organization-level publishing settings.
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.
14. publishing_channels_relationships
Links channels to related entities (default times, next times, episodes).
Common relationship types:
channel_default_times- Links to publishing_channel_default_timesnext_times- Links to publishing_channel_next_times
15. publishing_episodes_relationships
Links episodes to related entities (series, channels, resources, times, speakerships, note templates).
Common relationship types:
series- Links to publishing_serieschannel- Links to publishing_channelsepisode_resources- Links to publishing_episode_resourcesepisode_times- Links to publishing_episode_timesspeakerships- Links to publishing_speakershipsnote_template- Links to publishing_note_templates
16. publishing_series_relationships
Links series to related entities (channels, episodes).
17. publishing_speakerships_relationships
Links speakerships to related entities (speakers, episodes).
Common relationship types:
speaker- Links to publishing_speakersepisode- Links to publishing_episodes
System Fields
All tables include these system fields for data management:tenant_organization_id- Multi-tenant organization identifiersystem_status- Data lifecycle status (active,transferring,stale)system_created_at- When the record was created in Parablesystem_updated_at- When the record was last updated in Parable
Row Level Security
All tables implement Row Level Security (RLS) to ensure tenant isolation: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: Any monetization or purchase amount columns are stored in cents - divide by 100.0 for display
- Media Flags: Use booleans like
needs_video_urlandneeds_library_audio_or_video_urlto identify missing assets instead of relying onsystem_status - Relationship Tables: All inter-entity links are stored in
*_relationshipstables — usepublishing_episodes_relationships,publishing_channels_relationships, etc. for joins
Common Mistakes to Avoid
-
Missing Schema Prefix
- ❌
FROM publishing_episodes - ✅
FROM planning_center.publishing_episodes
- ❌
-
Adding Redundant RLS Filters
- ❌
WHERE tenant_organization_id = 1 AND system_status = 'active' - ✅ Trust RLS to handle this automatically
- ❌
-
Joining Without Schema
- ❌
JOIN publishing_series s ON ... - ✅
JOIN planning_center.publishing_series s ON ...
- ❌
-
Skipping Currency Conversion
- ❌
SELECT purchase_price_cents as purchase_price - ✅
SELECT purchase_price_cents / 100.0 as purchase_price
- ❌
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 publication state or media availability when relevant
- Consider CTEs for aggregating view/download metrics
- Use relationship tables for all cross-entity joins
- Always use the
Data Synchronization
Publishing data is synchronized through Temporal workflows:- Master Workflow - Orchestrates all child workflows
- Independent Entities - Channels, Series, Speakers, Organizations
- Dependent Entities - Episodes (depends on channels)
- Related Data - Resources, times, statistics (depends on episodes)
- Junction Tables - Speakerships linking episodes to speakers
Usage Tips
- Trust RLS for active data - Skip manual
system_statusor tenant filters - Join through relationship tables - Use
publishing_episodes_relationships,publishing_channels_relationships, etc. - Consider NULL values - Many fields are optional
- Use JSONB operators for nested data in
art,sermon_audio,page_actionsfields - Aggregate statistics over time periods for trends
Common Join Patterns
Episodes with Series and Speakers
Episodes with Statistics and Resources
Data Quality Notes
- Episode
published_live_atindicates published content - Series may have NULL
ended_atfor ongoing series - Statistics are point-in-time snapshots (
episode_statistics_id = 'es-' || episode_id) - Speakerships link episodes to speakers via
publishing_episodes_relationshipsandpublishing_speakerships_relationships - Episodes link to channels, series, and resources via
publishing_episodes_relationships
This data model enables comprehensive media analytics and content management for your church’s publishing ministry.