1
Database-Schema
Jonathan Miller edited this page 2026-06-29 16:47:55 +00:00

Database Schema

MokoSuiteCross uses 6 InnoDB tables with utf8mb4_unicode_ci collation. All tables use the #__ Joomla table prefix.


Tables Overview

Table Purpose Rows on Install
#__mokosuitecross_services Platform connections with encrypted credentials 0
#__mokosuitecross_posts Cross-post queue, status tracking, and delivery history 0
#__mokosuitecross_templates Per-platform message templates with placeholders 22 (seeded)
#__mokosuitecross_logs Activity and error logging 0
#__mokosuitecross_analytics Posting analytics for heatmap and stats 0
#__mokosuitecross_category_rules Category-to-service routing rules 0

#__mokosuitecross_services

Platform API connections. Each row represents one connected account (e.g., one Twitter account, one Mastodon instance).

Column Type Description
id int unsigned PK Auto-increment
title varchar(255) Display name
alias varchar(400) URL-safe alias
service_type varchar(50) Platform identifier (facebook, twitter, mastodon, bluesky, mailchimp, telegram, discord, slack, etc.)
credentials text JSON encrypted -- API keys, tokens, secrets
params text JSON -- service-specific configuration
published tinyint(1) Publish state
ordering int Sort order
created datetime Created timestamp
modified datetime Modified timestamp
created_by int unsigned FK to #__users.id
checked_out int unsigned Checked-out user
checked_out_time datetime Checked-out timestamp

Indexes: idx_published, idx_service_type


#__mokosuitecross_posts

Cross-post queue and delivery history. Each row is one article-to-service dispatch.

Column Type Description
id int unsigned PK Auto-increment
article_id int unsigned FK to #__content.id
service_id int unsigned FK to #__mokosuitecross_services.id
status varchar(20) Status: queued, posting, posted, failed, scheduled, deleted
message text Rendered message sent to platform
platform_post_id varchar(255) Post ID returned by platform
platform_response text JSON -- full API response from platform
scheduled_at datetime When to post (NULL = immediately)
posted_at datetime When actually posted
retry_count int unsigned Retry attempts so far
error_message text Error details on failure
created datetime Created timestamp
modified datetime Modified timestamp

Indexes: idx_article, idx_service, idx_status, idx_scheduled


#__mokosuitecross_templates

Per-platform message templates with placeholder support.

Column Type Description
id int unsigned PK Auto-increment
service_type varchar(50) Platform this template is for (or "default")
title varchar(255) Template name
template_body text Template with placeholders: {title}, {url}, {introtext}, {image}, {category}, {author}, {social}, {short}, {chat}, {email_body}, {email_subject}, {hashtags}, {field:xxx}, {random:opt1|opt2}, {url_short}, {url_raw}
published tinyint(1) Publish state
ordering int Sort order
created datetime Created timestamp
modified datetime Modified timestamp

Indexes: idx_service_type, idx_published

Seed data: 22 default templates are inserted on install covering: default, twitter, mastodon, mailchimp, telegram, discord, slack, facebook, linkedin, bluesky, threads, teams, medium, wordpress, webhook, sendgrid, brevo, ntfy, reddit, pinterest, instagram, youtube.


#__mokosuitecross_logs

Activity and error logging with configurable retention.

Column Type Description
id int unsigned PK Auto-increment
post_id int unsigned FK to #__mokosuitecross_posts.id (nullable)
service_id int unsigned FK to #__mokosuitecross_services.id (nullable)
level varchar(20) Log level: info, warning, error
message text Log message
context text JSON -- additional context data
created datetime Created timestamp

Indexes: idx_post, idx_service, idx_level, idx_created


#__mokosuitecross_analytics

Posting analytics data for the best-time-to-post heatmap.

Column Type Description
id int unsigned PK Auto-increment
post_id int unsigned FK to #__mokosuitecross_posts.id
service_id int unsigned FK to #__mokosuitecross_services.id
service_type varchar(50) Platform identifier
posted_at datetime When the post was published
day_of_week tinyint unsigned Day (0=Sunday, 6=Saturday)
hour_of_day tinyint unsigned Hour (0-23)
impressions int unsigned View count
engagements int unsigned Interaction count
clicks int unsigned Click count
shares int unsigned Share/repost count
engagement_rate decimal(5,2) Calculated engagement rate
created datetime Record created timestamp

Indexes: idx_service_type, idx_day_hour, idx_post


#__mokosuitecross_category_rules

Maps Joomla content categories to specific services for automatic routing.

Column Type Description
id int unsigned PK Auto-increment
category_id int unsigned FK to #__categories.id
service_id int unsigned FK to #__mokosuitecross_services.id
published tinyint(1) Rule active state

Indexes: idx_category_service (UNIQUE), idx_category


Entity Relationships

#__content (Joomla articles)
  └── #__mokosuitecross_posts (1:many via article_id)
        ├── #__mokosuitecross_services (many:1 via service_id)
        ├── #__mokosuitecross_logs (1:many via post_id)
        └── #__mokosuitecross_analytics (1:many via post_id)

#__mokosuitecross_services
  ├── #__mokosuitecross_posts (1:many)
  ├── #__mokosuitecross_logs (1:many)
  ├── #__mokosuitecross_analytics (1:many)
  └── #__mokosuitecross_category_rules (1:many via service_id)

#__categories (Joomla categories)
  └── #__mokosuitecross_category_rules (1:many via category_id)

#__mokosuitecross_templates (standalone, linked by service_type string)

Uninstall

The uninstall SQL drops all 6 tables:

DROP TABLE IF EXISTS `#__mokosuitecross_services`;
DROP TABLE IF EXISTS `#__mokosuitecross_posts`;
DROP TABLE IF EXISTS `#__mokosuitecross_templates`;
DROP TABLE IF EXISTS `#__mokosuitecross_logs`;
DROP TABLE IF EXISTS `#__mokosuitecross_analytics`;
DROP TABLE IF EXISTS `#__mokosuitecross_category_rules`;