Database Schema

Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

The plugin adds several Database tables.

Actionmeta

CREATE TABLE `wp_gdbbx_actionmeta` (
    `meta_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `action_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `meta_key` VARCHAR(128) NULL DEFAULT NULL,
    `meta_value` LONGTEXT NULL DEFAULT NULL,
    PRIMARY KEY (`meta_id`) ,
    INDEX `action_id` (`action_id`) ,
    INDEX `meta_key` (`meta_key`) 
) ENGINE=InnoDB;

Actions

CCREATE TABLE `wp_gdbbx_actions` (
    `action_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `user_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `post_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `logged` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'gmt',
    `action` VARCHAR(128) NOT NULL DEFAULT '',
    `reference_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    PRIMARY KEY (`action_id`) ,
    INDEX `user_id` (`user_id`) ,
    INDEX `post_id` (`post_id`) ,
    INDEX `action` (`action`) ,
    INDEX `reference_id` (`reference_id`) 
) ENGINE=InnoDB;

Attachments

CREATE TABLE `wp_gdbbx_attachments` (
    `post_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `attachment_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    UNIQUE INDEX `post_id_attachment_id` (`post_id`, `attachment_id`) ,
    INDEX `post_id` (`post_id`) ,
    INDEX `attachment_id` (`attachment_id`) 
) ENGINE=InnoDB;

Forums

CREATE TABLE `wp_gdbbx_forums` (
    `forum_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `forum_type` VARCHAR(32) NOT NULL DEFAULT 'forum',
    `forum_status` VARCHAR(32) NOT NULL DEFAULT 'open',
    `last_active_time` DATETIME NULL DEFAULT '0000-00-00 00:00:00',
    `forum_visibility` VARCHAR(32) NOT NULL DEFAULT 'publish',
    `forum_subforum_count` INT(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`forum_id`) ,
    INDEX `last_active_time` (`last_active_time`) ,
    INDEX `forum_type` (`forum_type`) ,
    INDEX `forum_status` (`forum_status`) ,
    INDEX `forum_visibility` (`forum_visibility`) 
) ENGINE=InnoDB;

Forums Read

CREATE TABLE `wp_gdbbx_forums_read` (
    `user_id` BIGINT(20) UNSIGNED NOT NULL,
    `forum_id` BIGINT(20) UNSIGNED NOT NULL,
    `marked` DATETIME NOT NULL,
    PRIMARY KEY (`user_id`, `forum_id`) 
) ENGINE=InnoDB;

Online

CREATE TABLE `wp_gdbbx_online` (
    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    `logged` TIMESTAMP NOT NULL DEFAULT 'CURRENT_TIMESTAMP',
    `user_type` VARCHAR(20) NOT NULL DEFAULT '',
    `user_key` VARCHAR(20) NOT NULL DEFAULT '',
    `user_role` VARCHAR(128) NOT NULL DEFAULT '',
    `content` VARCHAR(20) NOT NULL DEFAULT 'topic' COMMENT 'topic,forum,view,profile',
    `forum_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `topic_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `profile_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `topic_view` VARCHAR(128) NOT NULL DEFAULT '',
    PRIMARY KEY (`id`) ,
    INDEX `logged` (`logged`) ,
    INDEX `user_type` (`user_type`) ,
    INDEX `user_key` (`user_key`) ,
    INDEX `user_role` (`user_role`) ,
    INDEX `content` (`content`) ,
    INDEX `forum_id` (`forum_id`) ,
    INDEX `topic_id` (`topic_id`) ,
    INDEX `profile_id` (`profile_id`) ,
    INDEX `topic_view` (`topic_view`) 
) ENGINE=InnoDB;

Replies

CREATE TABLE `wp_gdbbx_replies` (
    `reply_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `topic_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `forum_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `parent_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    PRIMARY KEY (`reply_id`) ,
    INDEX `topic_id` (`topic_id`) ,
    INDEX `forum_id` (`forum_id`) ,
    INDEX `parent_id` (`parent_id`) 
) ENGINE=InnoDB;

Topic

CREATE TABLE `wp_gdbbx_topics` (
    `topic_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `forum_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `last_active_time` DATETIME NULL DEFAULT '0000-00-00 00:00:00',
    `reply_count` INT(10) UNSIGNED NOT NULL DEFAULT '0',
    `last_reply_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
    `attachments_count` INT(10) UNSIGNED NOT NULL DEFAULT '0',
    PRIMARY KEY (`topic_id`) ,
    INDEX `forum_id` (`forum_id`) ,
    INDEX `last_active_time` (`last_active_time`) ,
    INDEX `last_reply_id` (`last_reply_id`) 
) ENGINE=InnoDB;

Tracker

CREATE TABLE `wp_gdbbx_tracker` (
    `user_id` BIGINT(20) UNSIGNED NOT NULL,
    `topic_id` BIGINT(20) UNSIGNED NOT NULL,
    `forum_id` BIGINT(20) UNSIGNED NOT NULL,
    `reply_id` BIGINT(20) UNSIGNED NOT NULL,
    `latest` DATETIME NOT NULL,
    PRIMARY KEY (`user_id`, `topic_id`) ,
    INDEX `forum_id` (`forum_id`) ,
    INDEX `reply_id` (`reply_id`) ,
    INDEX `latest` (`latest`) 
) ENGINE=InnoDB;
Rate this article
0
0
2476

You are not allowed to rate this post.

Leave a Comment

0
0
0
0
0
0
0
0
0