Skip to content

Instantly share code, notes, and snippets.

@scossar
Last active August 19, 2023 13:29
Show Gist options
  • Save scossar/b543ee7bd3cf94d939589b393eebaebb to your computer and use it in GitHub Desktop.
Save scossar/b543ee7bd3cf94d939589b393eebaebb to your computer and use it in GitHub Desktop.
Brief descriptions of Discourse's database tables
allowed_pm_users: Links a user with another user they are willing to receive private messages or chat direct messages from, specifying the users who can send messages to them.
anonymous_users: Facilitates "anonymous mode" by connecting a real user with an anonymous user through the master_user_id field.
api_key_scopes: Links API key permissions with corresponding API keys, specifying allowed resources, actions, and customizable parameters.
api_keys: Manages API keys, storing information such as user associations, creation details, allowed IP addresses, usage status, and hashed key values.
application_requests: Tracks site requests, recording counts per request type on a daily basis to monitor traffic patterns and usage trends.
assignments: Manages assigned topics, associating them with users for specific actions or follow-up, while retaining assignment status and including optional notes.
associated_groups: Facilitates group membership assignment through OAuth authentication, utilizing information from external providers.
backup_draft_posts: Stores draft post backups as private messages when enabled via a site setting. Utilizes user IDs, post IDs, keys, and timestamps to retain draft information within private message records.
backup_draft_topics: Preserves draft topic backups as private messages when enabled via a site setting. Utilizes user IDs, topic IDs, and timestamps to retain draft information within private message records.
backup_metadata: Captures metadata created during application database backups, encompassing various attributes such as base URLs, CDN URLs, and database settings.
badge_groupings: Organizes Discourse badges into logical groupings. For example, "Getting Started," "Community," and "Posting."
categories: Organizes topics within Discourse, providing a structured framework for content segmentation and management.
posts: Represent user-generated content organized within topics, encompassing textual content, engagement metrics, and relevant attributes.
topics: Form discussions through sequential posts, with elements like titles, user IDs, engagement metrics, and archetypes. Regular archetype topics are linked to categories, while private_message archetype topics remain uncategorized.
badge_posts: Consist of posts for which badges can be awarded. These posts are accessible to all forum members.
badge_types: Represent categories of badges, such as "Gold," "Silver," or "Bronze," indicating the level of difficulty associated with earning each badge.
badges: Recognitions bestowed upon users based on their site activity. For instance, the "Autobiographer" badge can be earned by users who complete their profile information.
bookmarks: Users save posts for later reference, with optional reminders for specific times.
calendar_events: Utilized by the Discourse Calendar plugin for upcoming events. Each event is associated with a post or topic, and includes start and end dates, recurrence, region, and timezone.
categories_web_hooks: A web hook triggered when a category is created, updated, or removed.
category_custom_fields: Custom text fields associated with specific categories.
category_featured_topics: Topics that can be displayed on the Categories page for enhanced visibility.
category_groups: Links a Discourse group with a category, determining user groups with access to the category for managing permissions.
category_required_tag_groups: Specifies tag groups that must be utilized within a category, along with the minimum required count and order.
category_search_data: Stores search-related data for categories, including a text representation, a search vector, locale information, and version number.
category_tag_groups: Associates tag groups with categories, enabling the use of specific tag groups within a category. Unlike category_required_tag_groups, the tags from these groups are not obligatory for the topics in the category.
category_tag_stats: Records the frequency of tag usage within a specific category by storing the count of how many times each tag has been applied to topics within that category.
category_tags: Enables a category to specify a subset of tags that can be used for topics within that category.
category_users: Stores the notification level of users for a specific category.
child_themes: This table, of interest to developers, establishes associations between child themes and their respective parent themes using the parent_theme_id field
color_scheme_colors: This table, of interest to developers, stores hex colors utilized by a color scheme. The color_scheme_id field associates them with corresponding color schemes.
color_schemes: This table, of interest to developers, stores various color schemes. Comprised of color_scheme_colors and includes fields for versioning and customization options.
custom_emojis: A collection of user-uploaded custom emojis. Linked to uploads through their upload_id for storage and retrieval.
data_explorer_queries: Stores PostgreSQL queries available for execution through the Discourse Data Explorer plugin.
data_explorer_query_groups: Facilitates the permission of Discourse groups to execute Data Explorer queries by associating groups with queries using query_id and group_id.
developers: (needs review)
directory_columns: Defines the attributes by which users can be sorted on the site's Users page. These columns provide sorting options such as "likes received," "likes given," and "topic count."
directory_items: Displays user activity data on the Users page, including likes received, given, topics entered, post counts, days visited, and solutions provided. Created if enable_user_directory is active.
discourse_automation_automations: Automations generated using the Discourse Automations Plugin, containing scripts and settings to perform specific actions.
discourse_automation_fields: Fields linked to specific automations through the automation_id column.
discourse_automation_pending_automations: Scheduled automations awaiting execution, linked to specific automation tasks through the automation_id column.
discourse_automation_pending_pms: Scheduled creation of personal messages by the Discourse Automation plugin, tied to a specific automation through the automation_id column. Execution time is designated by the execute_at column.
discourse_automation_user_global_notices: Scheduled user-specific global notices by the Discourse Automation plugin. Triggers site-wide notices for users based on specific events. Associated with users through user_id and identified by identifier with a determined level.
discourse_calendar_post_event_dates: Part of the Discourse Calendar plugin. Manages event timing, reminders, and notifications for users who plan to attend.
discourse_post_event_events: Part of the Discourse Calendar plugin. Manages event details such as status, timing, invitees, and custom fields.
discourse_post_event_invitees: Part of the Discourse Calendar plugin. Stores information about users who plan to attend events, indicating their status and notification status.
discourse_reactions_reaction_users: Part of the Discourse Reactions plugin. Links users to specific reactions through their user_id and reaction_id.
discourse_reactions_reactions: Part of the Discourse Reactions plugin. Tracks the instances and count of specific reactions applied to posts.
discourse_staff_alias_users_post_revisions_links: Part of the Discourse Staff Alias plugin. Connects user aliases with post revisions.
discourse_staff_alias_users_posts_links: Part of the Discourse Staff Alias plugin. Links user aliases with posts.
discourse_subscriptions_customers: Part of the Discourse Subscriptions plugin. Records customer information for subscription-related services.
discourse_subscriptions_products: Part of the Discourse Subscriptions plugin. Stores information about subscription products using their external IDs.
discourse_subscriptions_subscriptions: Part of the Discourse Subscriptions plugin. Records subscription information for customers, including their external IDs.
discourse_voting_category_settings: Part of the Discourse Voting plugin. Determines whether voting is allowed on topics within specific categories.
discourse_voting_topic_vote_count: Part of the Discourse Voting plugin. Tracks the number of votes on a topic.
discourse_voting_votes: Part of the Discourse Voting plugin. Logs user votes on topics.
dismissed_topic_users: Records are created when a user reads a topic from their New or Unread topic list, or when a user clicks the "dismiss" button from either of those lists.
do_not_disturb_timings: Time periods during which a user should not receive notifications. Associates a user_id with starts_at and ends_at timestamps.
draft_sequences: Stores the sequence of draft posts saved for a user, identified by their user_id and draft_key.
drafts: Stores the text of draft posts saved for a user, identified by their user_id and draft_key.
email_change_requests: Records a user's requests to change their email address, including the user_id, old and new email addresses, and the change state.
email_logs: Records of emails sent from the site, including recipient addresses, email type, sender information, and additional details.
email_tokens: Tokens for email confirmation requests, validating email changes or confirmations for users, linked to user IDs, emails, and status.
embeddable_hosts: Defines authorized host domains for topic creation using the Discourse JavaScript embed code.
external_upload_stubs: Records information about files uploaded externally and used within Discourse (description needs review)
github_commits: Part of the Discourse GitHub plugin, records information about commits for badge assignment.
github_repos: Part of the Discourse GitHub plugin, specifies repositories for badge awards.
given_daily_likes: Tracks the daily likes given by a user, including whether they've reached their like limit.
group_archived_messages: Stores archived private messages within a group's inbox.
group_associated_groups: Facilitates the synchronization of membership in a Discourse group with membership in an OAuth provider's group for authorization purposes.
group_category_notification_defaults: Establishes the default notification level for private messages within a group.
group_custom_fields: Holds custom text fields linked to a group.
group_histories: Logs actions performed on a group, such as user additions or removals.
group_mentions: Tracks instances of when a group is mentioned within a post.
group_requests: Records user requests to join a group, including the user, group, reason, and timestamps.
group_tag_notification_defaults: Sets the default notification level for a specific tag's activity for members of a group.
group_users: Connects the groups and users tables to track group memberships for users, including ownership and notification settings.
groups: Represents a Discourse group.
groups_web_hooks: Records the association between web hooks and groups. Triggered on group creation, update, or deletion.
ignored_users: Links a user with another user they have chosen to ignore.
imap_sync_logs: Records synchronization logs related to IMAP mailbox operations.
incoming_domains: Records external domain names used for incoming links to the Discourse site.
incoming_emails: Records incoming emails that can generate new topics or replies in the Discourse platform.
incoming_links: Records links from external sites to Discourse.
incoming_referers: Stores the path of incoming links. Linked to an incoming_domain through the incoming_domain_id field.
invited_groups: records the relationship between groups and invites.
invited_users: tracks users who have received invitations to join the site.
invites: a sent invitation to join the site, containing details like the invite key, email, inviter's ID, redemption status, and expiration date.
javascript_caches: a storage for cached JavaScript content, particularly of interest to developers working with the Discourse theme system. It contains fields like the theme field ID, digest, content, and timestamps.
linked_topics: establishes connections between topics using the topic_id and original_topic_id fields. These connections are formed when a link to one topic is added within another topic.
muted_users: tracks instances where a user has muted another user.
notifications: alerts sent to users regarding site activity.
oauth2_user_infos: user information received from an external authentication provider during the OAuth2 authentication process.
onceoff_logs: Records of various background tasks executed by Discourse.
optimized_images: Images optimized by Discourse from uploads, linked to an upload through the upload_id field.
permalinks: Links added to posts, connecting to specific topics, posts, or categories.
plugin_store_rows: Enables plugins to incorporate key/value text fields. Of interest to developers.
policy_users: Utilized by the Discourse policy plugin. Records users requested to accept a policy.
poll_options: Voting options for Discourse polls, associated with a poll through the poll_id field.
poll_votes: Records a user's vote on a Discourse poll, associating the poll, user, and poll option through their respective fields: poll_id, poll_option_id, and user_id.
polls: Represents a Discourse poll added to a post, capturing attributes like its name, close_at time, type, status, results, visibility, min, max, step, anonymous_voters, chart_type, groups, and title.
post_action_types: Contains a list of actions that can be performed on a post, such as 'like', 'off_topic', 'inappropriate', 'spam', 'notify_user', and 'notify_moderators'. It records attributes like the name_key, whether it's a flag (is_flag), associated icon, position, score_bonus, and reviewable_priority. For example, users can flag a post as inappropriate, and the table includes action types and their corresponding IDs.
post_actions: Records user actions on posts based on predefined types, such as 'like' or 'flag'.
post_custom_fields: Stores custom text fields associated with a post.
post_details: Records additional details related to posts, potentially of interest to developers. (description needs review)
post_hotlinked_media: Records external media URLs that are linked in a post. Tracks the URL, status, and potential association with an upload.
post_policies: Part of the Discourse Policy plugin. Associates a policy with a post. Tracks policy renewal details and related metadata.
post_replies: Facilitates replying to posts via email. Tracks relationships between posts and their replies.
post_reply_keys: Facilitates replying to posts via email. Associates users with specific post-reply pairs using reply keys.
post_revisions: Tracks revisions made to posts, recording modifications, revision number, and more.
post_search_data: Contains search-related data for a post, including tokenized search_data, raw_data, locale, version, and private_message indicator.
post_stats: Records typing and composer (post editor) interaction statistics for a post, including user typing duration and composer open duration in milliseconds.
post_timings: Records the time in milliseconds that a user spent reading a specific post within a topic.
post_uploads: Tracks the uploads that are linked to a particular post.
published_pages: Records the association between a topic and a published page in Discourse, allowing topics to be transformed into standalone pages.
push_subscriptions: Records user subscriptions for push notifications, including relevant data and error information.
quoted_posts: Records instances where a post has been quoted within another post.
remote_themes: Tracks themes from remote repositories integrated into Discourse's theme system, including version details and compatibility with Discourse versions (of interest to developers).
reviewable_claimed_topics: A reviewable (flagged) topic that has been claimed by a staff member. This is Discourse's terminology for topics undergoing review.
reviewable_histories: A record of previously handled reviewables (flags), including information about their history, status changes, and edits made by staff members.
reviewable_scores: The scores generated for a reviewable (flagged) post, determining how Discourse handles the post, including potential actions like automatic hiding, based on the calculated score.
reviewables: Posts or users sent to the "review queue" for staff evaluation and action.
screened_emails: Email addresses that are prevented from interacting with the site.
screened_ip_addresses: IP addresses that are prevented from interacting with the site.
screened_urls: URLs that are known to be associated with spammers.
search_logs: Records of search terms used on the site, associated with user IDs.
shared_drafts: Topics that contain shared drafts, identified by a topic_id and a category_id.
shelved_notifications: Used for storing information about shelved notifications, particularly relevant to developers.
single_sign_on_records: Records used for authentication with DiscourseConnect (Discourse's SSO implementation). Associates a user_id with an external_id.
site_settings: Stores Discourse site configuration options, including the setting name, its data_type, and the corresponding value.
sitemaps: Stores information about Discourse site sitemaps, including the name, the timestamp of the last posted content (last_posted_at), and whether the sitemap is enabled.
skipped_code_reviews: Utilized by the Discourse Code Review plugin. Records instances when users skip code reviews for a specific topic.
skipped_email_logs: Records notification emails that were not sent and the reasons for their non-delivery, such as recent user activity.
stylesheet_cache: stylesheets that are cached by Discourse (of interest to developers.)
tag_group_memberships: Connects tags with tag groups through the tag_id and tag_group_id fields.
tag_group_permissions: Establishes permission types for tag groups, determining actions such as which user groups can add tags from the group to topics.
tag_groups: Organizational containers for tags. These groups can be linked with categories to manage which tags are allowed or required within specific categories.
tag_search_data: Indexed search data associated with tags. This table stores the text search vector, raw data, locale, and version information for tags.
tag_users: Stores information about a user's notification level for a specific tag. This table includes the tag_id, user_id, and the notification level set by the user for that tag.
tags: Tags are a means of connecting topics, including private messages, across the platform. This table holds information about each tag, including its name, topic_count, pm_topic_count, and description.
tags_web_hooks: Webhooks triggered when a tag is created, updated, or deleted.
theme_fields: Utilized within the Discourse theme system, these fields facilitate the association of text fields with specific themes.
theme_modifier_sets: As a component of the Discourse theme system, this table holds information essential for modifying themes. It includes data such as whether to serialize topic excerpts, arrays of CSP extensions, SVG icons, and topic thumbnail sizes.
theme_settings: Part of the Discourse theme system, this table stores settings that can be added to a theme, including the setting's name, data type, value, associated theme ID, and creation/update timestamps.
theme_translation_overrides: Part of Discourse's theme system, this table enables themes to replace site text by storing theme IDs, locales, translation keys, new values, and timestamps for customization.
themes: Represents themes in Discourse, including metadata such as name, creator, timestamps, and settings like visibility, color scheme, and auto-update.
top_topics: Collects statistics for Discourse's top topic lists, tracking daily, weekly, monthly, yearly, and all-time metrics for post and like counts associated with a specific topic_id.
topic_allowed_groups: An association table linking the `groups` and `topics` tables. It controls group access to `private_message` topics.
topic_allowed_users: An association table connecting users and topics. It manages user access to private_message topics.
topic_custom_fields: Stores additional text fields associated with a topic.
topic_embeds: Stores embedded content URLs related to topics.
topic_groups: Tracks the last read post number by group members in private_message topics.
topic_invites: Records topic-specific invitation IDs and their creation details.
topic_link_clicks: Tracks user interactions with topic-specific links.
topic_links: Stores details about links shared within topics, including user interactions and metadata.
topic_search_data: Stores indexed search data related to topics, including raw data and locale.
topic_tags: Links tags to topics, maintaining creation and update timestamps.
topic_thumbnails: Stores information about thumbnails associated with uploads, including optimized images and size constraints.
topic_timers: Manages scheduled actions on topics, including execution times, statuses, and related attributes.
topic_users: Records user-specific topic interactions, including read statuses, visit times, notification levels, and engagement metrics.
topic_views: Tracks topic views by either logged-in users (via user_id) or anonymous users (via ip_address).
translation_overrides: Stores customized translations for default text, including locale, keys, and values.
unsubscribe_keys: Stores keys for users to unsubscribe from specific email types, including user information and related context such as topic and post IDs.
uploads: Manages user-uploaded files with details including file properties, URLs, and security settings.
user_actions: Records various actions performed by users, including likes, replies, mentions, edits, and private messages, with related details and associations.
user_api_key_scopes: Of interest to developers, this table stores API key scope details for user-specific access, enabling secure app access to Discourse instances.
user_api_keys: Of interest to developers, records API key details including user associations, client information, scopes, and usage statistics for secure application access to Discourse instances.
user_archived_messages: Stores details about archived messages in users' inboxes, including user associations and related topic information.
user_associated_accounts: Manages details related to user authentication with external authentication providers, including provider names, user information, and associated credentials.
user_associated_groups: Facilitates synchronization of user-associated groups between the application and external authentication provider sites, maintaining user-group associations and authentication-related timestamps.
user_auth_token_logs: Logs authentication-related actions and details, such as user authentication tokens, user agents, IP addresses, and associated paths.
user_auth_tokens: Manages user authentication tokens and their rotation, along with details such as user agents and client IP addresses, for enhanced security in user authentication processes.
user_avatars: Stores user avatar details, including custom uploads and Gravatar information, with associated timestamps.
user_badges: Establishes associations between badges and users, including details about when badges were granted and related context.
user_custom_fields: Permits the association of text fields with users, storing custom information with details such as names, values, and timestamps.
user_emails: Stores user email addresses, including primary email status.
user_exports: Records users' activity download records, including file names, user associations, and timestamps.
user_field_options: Stores options for user field choices, associated with user field IDs and timestamps.
user_fields: Manages user field definitions, including field names, types, descriptions, and various display properties for the site's signup and user preferences pages.
user_histories: Logs staff actions on the site, capturing details about actions, users, and context.
user_ip_address_histories: Tracks changes to a user's IP address over time.
user_notification_schedules: Stores user notification schedules, allowing users to set specific times for notifications on each day of the week.
user_options: Manages user preferences and options that can be set on the user's preferences page, providing customization for various aspects of the user experience.
user_profile_views: Records instances of user profile page views.
user_profiles: Stores various details related to a user's profile page, including location, website, biography content, background uploads, badge information, and profile views.
user_search_data: Stores search-related data for users, including text search vectors, raw data, locale information, and version numbers.
user_second_factors: Manages user's second-factor authentication methods, including details such as authentication method, associated data, enabling status, timestamps, and names.
user_security_keys: Stores user's security key information for two-factor authentication, capturing details like credential IDs, public keys, factor types, enabling status, names, and timestamps.
user_stats: Stores user-specific statistics like post and topic counts, read activity, likes, and timestamps for various actions.
user_statuses: Tracks user statuses using emojis and descriptions, including start and optional end times.
user_uploads: Relates to the uploads table and retains user-specific upload associations.
user_visits: Stores user visits, differentiated by device type per day, reflecting changes in the mobile boolean. Tracks post reading activity and user-specific visit details.
user_warnings: Captures warnings issued by staff to users, linked with specific topics and creation information.
users: Represents site users, storing user-specific information including usernames, trust levels, and roles like moderators and administrators.
watched_words: Records specific words that trigger automated actions in user posts, associated actions.
web_crawler_requests: Logs requests made by web crawlers, including dates, user agent information, and request counts.
web_hook_event_types: Stores event type names relevant to web hooks.
web_hook_event_types_hooks: Maps web hook event types to web hooks.
web_hook_events: Records details of web hook events, including headers, payload, status, response details, and timestamps.
web_hooks: Represents web hooks, tracking payload URLs, delivery status, secret, and other configuration settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment