Database Schema

Complete reference for all 23 database tables in Scriptlog. All tables use utf8mb4 charset and InnoDB engine.

Home / Documentation / Database Schema
Note: All tables use utf8mb4 charset and InnoDB engine. The only real foreign key is tbl_api_keys.user_id → tbl_users.ID (ON DELETE CASCADE); every other relationship is application-managed.
S10 hot-filter indexes: fresh installations get idx_post_date and idx_post_type_status on tbl_posts, idx_post_topic_topic on tbl_post_topic, and idx_comment_post_status on tbl_comments from install/include/dbtable.php. Existing installations add them with install/migrate-hot-filter-indexes.php (CLI only; idempotent, safe to run twice). See docs/dev-docs/DATABASE_SCHEMA_GUIDE.md and plan/PERFORMANCE_PLAN_SEPTEMBER2026.md §S10.

tbl_users

User accounts and authentication.

Column Type Description
IDBIGINT(20) UNSIGNEDPrimary key
user_loginVARCHAR(60)Unique username
user_emailVARCHAR(100)Unique email
user_passVARCHAR(255)Password hash
user_levelVARCHAR(20)Role (administrator, manager, editor, author, contributor, subscriber)
user_fullnameVARCHAR(120)Display name
user_urlVARCHAR(100)Website URL
user_registeredDATETIMERegistration date
user_activation_keyVARCHAR(255)Activation token
user_reset_keyVARCHAR(255)Password reset token
user_reset_completeVARCHAR(3)Password reset finished (Yes/No)
user_sessionVARCHAR(255)Session identifier
user_bannedTINYINTBan status (0/1)
user_signin_countINTLogin count
user_locked_untilDATETIMEAccount lock expiry
login_timeTIMESTAMPLast login or profile change

tbl_posts

Blog posts and pages.

Column Type Description
IDBIGINT(20) UNSIGNEDPrimary key
media_idBIGINT(20) UNSIGNEDFeatured media (application-managed link to tbl_media)
post_authorBIGINT(20) UNSIGNEDAuthor ID (application-managed link to tbl_users)
post_dateDATETIMEPublication date
post_modifiedDATETIMELast modified date
post_titleTINYTEXTPost title
post_slugVARCHAR(255)URL slug (indexed, used for canonical URLs)
post_contentLONGTEXTFull content
post_summaryMEDIUMTEXTExcerpt/preview
post_keywordTEXTSEO keywords
post_statusVARCHAR(20)publish, draft, pending
post_visibilityVARCHAR(20)public, private
post_passwordVARCHAR(255)Password for protected posts
post_tagsTEXTComma-separated tags (FULLTEXT indexed)
post_headlinesINTNumber of headline entries
post_stickyINT1 pins the post to the top of listings
post_typeVARCHAR(120)blog or page
post_localeVARCHAR(10)Language code (i18n)
comment_statusVARCHAR(20)open, closed
passphraseVARCHAR(255)Hash for the protected post unlock flow

Indexes: PRIMARY KEY (ID), author_id (post_author), post_media (media_id), idx_post_slug (post_slug), idx_post_locale (post_locale), idx_post_status_date (post_status, post_date), idx_post_date (post_date), idx_post_type_status (post_type, post_status, post_date), FULLTEXT (post_tags, post_title, post_content). S10 hot-filter indexes: idx_post_date speeds date-ordered and archive listings; idx_post_type_status speeds listings filtered by content type and status ordered by date.

tbl_topics

Categories/topics for organizing posts.

Column Type Description
IDBIGINT(20) UNSIGNEDPrimary key
topic_titleVARCHAR(255)Category name
topic_slugVARCHAR(255)URL slug
topic_statusENUM('Y','N')Active/inactive
topic_localeVARCHAR(10)Language code (i18n)

tbl_comments

Comments and replies.

Column Type Description
IDBIGINT(20) UNSIGNEDPrimary key
comment_post_idBIGINT(20) UNSIGNEDPost ID (application-managed link to tbl_posts)
comment_parent_idBIGINT(20)Parent comment ID (0 for top-level)
comment_author_nameVARCHAR(60)Author name
comment_author_ipVARCHAR(100)Author IP address
comment_author_emailVARCHAR(100)Author email
comment_contentTEXTComment text
comment_statusVARCHAR(20)approved, pending, spam
comment_dateDATETIMESubmission date

Indexes: PRIMARY KEY (ID), id_comment_post (comment_post_id), idx_comment_post_status (comment_post_id, comment_status). S10 hot-filter index: idx_comment_post_status speeds the hot frontend filter on post plus status (for example approved comments of one post).

tbl_media

Media library files.

Column Type Description
IDBIGINT(20) UNSIGNEDPrimary key
media_filenameVARCHAR(200)File name
media_captionVARCHAR(200)File caption
media_typeVARCHAR(90)MIME type
media_targetVARCHAR(20)blog, post, page
media_userVARCHAR(20)Uploader
media_accessVARCHAR(10)public, private
media_statusINTStatus flag

tbl_menu

Navigation menus.

Column Type Description
IDINT(11) UNSIGNEDPrimary key
menu_labelVARCHAR(200)Menu item text
menu_linkVARCHAR(255)URL
menu_statusENUM('Y','N')Active/inactive (default N)
menu_visibilityVARCHAR(20)Visibility setting
parent_idINT(11) UNSIGNEDParent menu item (0 for top-level)
menu_sortINT(11) UNSIGNEDSort order
menu_localeVARCHAR(10)Language code (i18n)

tbl_settings

Configuration settings.

Column Type Description
IDINT(11) UNSIGNEDPrimary key
setting_nameVARCHAR(255)Setting key
setting_valueTEXTSetting value

tbl_themes

Installed themes.

Column Type Description
IDINT(11) UNSIGNEDPrimary key
theme_titleVARCHAR(100)Theme name
theme_descTINYTEXTDescription
theme_designerVARCHAR(90)Author
theme_directoryVARCHAR(100)Directory name
theme_statusENUM('Y','N')Active/inactive
theme_typeENUM('free','premium')Distribution type
license_keyVARCHAR(100)License key for premium themes
license_statusENUM('active','inactive','expired','invalid')Current license state
license_expires_atDATETIMELicense expiry (optional)

tbl_plugin

Installed plugins.

Column Type Description
IDBIGINT(20) UNSIGNEDPrimary key
plugin_nameVARCHAR(100)Plugin name
plugin_linkVARCHAR(255)Plugin URL (default '#')
plugin_directoryVARCHAR(100)Directory name
plugin_descTINYTEXTDescription
plugin_statusENUM('Y','N')Enabled/disabled
plugin_levelVARCHAR(20)Required level
plugin_sortINT(5)Sort order

Additional Tables

Table Purpose
tbl_user_tokenPersistent login ("remember me") tokens (selector + verifier hash)
tbl_login_attemptFailed login attempts by IP, used for lockout
tbl_api_keysREST API keys (only real foreign key: user_id → tbl_users.ID)
tbl_post_topicPost-topic relationships (many-to-many). Indexes: PRIMARY KEY (post_id, topic_id), idx_post_topic_topic (topic_id)
tbl_mediametaMedia metadata (key-value)
tbl_media_downloadSecure download grants (UUID identifier + expiry)
tbl_download_logAudit log of file downloads
tbl_theme_licensesPremium theme license activations
tbl_consentsGDPR consent records
tbl_data_requestsGDPR data requests
tbl_privacy_logsPrivacy audit trail
tbl_privacy_policiesPrivacy policy versions
tbl_languagesSupported languages (i18n)
tbl_translationsTranslation strings (i18n)