CREATE TABLE activity_data (id INT AUTO_INCREMENT COMMENT 'Serial number', member_id INT NOT NULL COMMENT 'Member id', in_reply_to_activity_id INT COMMENT 'Activity data id is in reply to', body VARCHAR(140) NOT NULL COMMENT 'Activity body', uri TEXT COMMENT 'Activity URI', public_flag TINYINT DEFAULT 1 NOT NULL COMMENT 'Public flag of activity', is_pc TINYINT(1) DEFAULT '1' NOT NULL COMMENT 'Display this in PC?', is_mobile TINYINT(1) DEFAULT '1' NOT NULL COMMENT 'Display this in Mobile?', source VARCHAR(64) COMMENT 'The source caption', source_uri TEXT COMMENT 'The source URI', foreign_table TEXT COMMENT 'Reference table name', foreign_id BIGINT COMMENT 'The id of reference table', template VARCHAR(64) COMMENT 'Template name', template_param LONGTEXT COMMENT 'Params for template', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX member_id_idx (member_id), INDEX in_reply_to_activity_id_idx (in_reply_to_activity_id), PRIMARY KEY(id)) COMMENT = 'Saves activities' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE activity_image (id INT AUTO_INCREMENT COMMENT 'Serial number', activity_data_id INT NOT NULL COMMENT 'Activity data id', mime_type VARCHAR(64) NOT NULL COMMENT 'MIME type', uri TEXT COMMENT 'Image URI', file_id INT COMMENT 'File id', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX activity_data_id_idx (activity_data_id), INDEX file_id_idx (file_id), PRIMARY KEY(id)) COMMENT = 'Saves image information of activity' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;

CREATE TABLE banner_translation (id INT COMMENT 'Serial number', caption TEXT NOT NULL COMMENT 'Description', lang CHAR(5), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE banner (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Banner name', html TEXT COMMENT 'HTML of free input banner', is_use_html TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'This is free HTML banner', UNIQUE INDEX name_UNIQUE_idx (name), PRIMARY KEY(id)) COMMENT = 'Saves informations about banner' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE banner_image (id INT AUTO_INCREMENT COMMENT 'Serial number', file_id INT NOT NULL COMMENT 'An image''''s file id', url TEXT COMMENT 'URL of linked Web page', name VARCHAR(64) COMMENT 'Banner image name', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX file_id_idx (file_id), PRIMARY KEY(id)) COMMENT = 'Saves informations about banner image files' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE banner_use_image (id INT AUTO_INCREMENT COMMENT 'Serial number', banner_id INT NOT NULL COMMENT 'Banner id', banner_image_id INT NOT NULL COMMENT 'BannerImage id', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX banner_id_idx (banner_id), INDEX banner_image_id_idx (banner_image_id), PRIMARY KEY(id)) COMMENT = 'Saves relations between banners and their images' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE blacklist (id INT AUTO_INCREMENT COMMENT 'Serial number', uid VARCHAR(32) DEFAULT '' NOT NULL COMMENT 'Mobile identified number', memo TEXT COMMENT 'Free memo', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX uid_UNIQUE_idx (uid), PRIMARY KEY(id)) COMMENT = 'Saves informations of blacklist' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE community (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Community name', file_id INT COMMENT 'Top image file id', community_category_id INT COMMENT 'Community category id', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX name_UNIQUE_idx (name), INDEX file_id_idx (file_id), INDEX community_category_id_idx (community_category_id), PRIMARY KEY(id)) COMMENT = 'Saves informations of communities' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE community_category (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Category name', is_allow_member_community TINYINT(1) DEFAULT '1' NOT NULL COMMENT 'Member can create this category community', tree_key INT COMMENT 'Nested tree key', sort_order INT COMMENT 'Order to sort', lft INT, rgt INT, level SMALLINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX lft_INDEX_idx (lft), PRIMARY KEY(id)) COMMENT = 'Saves categories of community' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE community_config (id INT AUTO_INCREMENT COMMENT 'Serial number', community_id INT NOT NULL COMMENT 'Community id', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Configuration name', value TEXT COMMENT 'Configuration value', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX community_id_idx (community_id), PRIMARY KEY(id)) COMMENT = 'Saves configurations of communities' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE community_member (id INT AUTO_INCREMENT COMMENT 'Serial number', community_id INT NOT NULL COMMENT 'Community id', member_id INT NOT NULL COMMENT 'Member id', is_pre TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Is pre member?', is_receive_mail_pc TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Notification of posting in community by computer E-mail.', is_receive_mail_mobile TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Notification of posting in community by mobile E-mail.', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX community_id_idx (community_id), INDEX member_id_idx (member_id), PRIMARY KEY(id)) COMMENT = 'Saves informations of members joined' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE community_member_position (id INT AUTO_INCREMENT COMMENT 'Serial number', community_id INT NOT NULL COMMENT 'Community id', member_id INT NOT NULL COMMENT 'Member id', community_member_id INT NOT NULL COMMENT 'Community Member id', name VARCHAR(32) NOT NULL COMMENT 'Member''''s position name in this community', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX name_UNIQUE_idx (community_member_id, name), INDEX community_id_idx (community_id), INDEX member_id_idx (member_id), INDEX community_member_id_idx (community_member_id), PRIMARY KEY(id)) COMMENT = 'Saves informations of the Community''''s member roles' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE file (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'File name', type VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Type of this file', filesize INT DEFAULT 0 NOT NULL COMMENT 'File size', original_filename TEXT COMMENT 'Original filename', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX name_UNIQUE_idx (name), PRIMARY KEY(id)) COMMENT = 'Saves informations of files uploaded' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE file_bin (file_id INT COMMENT 'File id', bin LONGBLOB COMMENT 'Content of file', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(file_id)) COMMENT = 'Saves content of files' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE gadget (id INT AUTO_INCREMENT COMMENT 'Serial number', type VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Gadget type', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Gadget name', sort_order INT COMMENT 'Order to sort', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX sort_order_INDEX_idx (sort_order), PRIMARY KEY(id)) COMMENT = 'Saves informations of gadget' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE gadget_config (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Configuration name', gadget_id INT COMMENT 'Gadget id', value TEXT COMMENT 'Configuration value', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX gadget_id_idx (gadget_id), PRIMARY KEY(id)) COMMENT = 'Saves configurations of gadget' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE member (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Nickname', invite_member_id INT COMMENT 'Member id of the person who invited this member', is_login_rejected TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Rejected member', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, is_active TINYINT(1) DEFAULT '0' NOT NULL, INDEX is_active_INDEX_idx (is_active), INDEX invite_member_id_idx (invite_member_id), PRIMARY KEY(id)) COMMENT = 'Saves informations of members' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE member_config (id INT AUTO_INCREMENT COMMENT 'Serial number', member_id INT NOT NULL COMMENT 'Member id', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Configuration name', value TEXT NOT NULL COMMENT 'Configuration value', value_datetime DATETIME COMMENT 'Configuration datetime value', name_value_hash VARCHAR(32) NOT NULL COMMENT 'Hash value for searching name & value', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX name_INDEX_idx (name), INDEX name_value_hash_INDEX_idx (name_value_hash), INDEX member_id_idx (member_id), PRIMARY KEY(id)) COMMENT = 'Saves configurations of each members' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE member_image (id INT AUTO_INCREMENT COMMENT 'Serial number', member_id INT NOT NULL COMMENT 'Member id', file_id INT NOT NULL COMMENT 'Image file id in the ''''file'''' table', is_primary TINYINT(1) COMMENT 'This is primary', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX member_id_idx (member_id), INDEX file_id_idx (file_id), PRIMARY KEY(id)) COMMENT = 'Saves images in member profiles' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE member_profile (id INT AUTO_INCREMENT COMMENT 'Serial number', member_id INT NOT NULL COMMENT 'Member id', profile_id INT NOT NULL COMMENT 'Profile id', profile_option_id INT COMMENT 'Profile option id', value TEXT NOT NULL COMMENT 'Text content for this profile item', value_datetime DATETIME COMMENT 'Profile datetime value', public_flag TINYINT COMMENT 'Public flag', tree_key BIGINT, lft INT, rgt INT, level SMALLINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX lft_INDEX_idx (lft), INDEX member_id_idx (member_id), INDEX profile_id_idx (profile_id), INDEX profile_option_id_idx (profile_option_id), PRIMARY KEY(id)) COMMENT = 'Saves informations of every member''''s profile' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE member_relationship (id INT AUTO_INCREMENT COMMENT 'Serial number', member_id_to INT NOT NULL COMMENT 'Target member id', member_id_from INT NOT NULL COMMENT 'Subject member id', is_friend TINYINT(1) COMMENT 'The members are friends', is_friend_pre TINYINT(1) COMMENT 'The members are going to be friends', is_access_block TINYINT(1) COMMENT 'The subject member is blocked the target', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX member_id_to_from_UNIQUE_idx (member_id_to, member_id_from), UNIQUE INDEX member_id_from_to_UNIQUE_idx (member_id_from, member_id_to), INDEX member_id_to_idx (member_id_to), INDEX member_id_from_idx (member_id_from), PRIMARY KEY(id)) COMMENT = 'Saves ralationships of each members' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE navigation_translation (id INT COMMENT 'Serial number', caption TEXT NOT NULL COMMENT 'Description', lang CHAR(5), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE navigation (id INT AUTO_INCREMENT COMMENT 'Serial number', type VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Navigation type', uri TEXT NOT NULL COMMENT 'Linked page''''s URI', sort_order INT COMMENT 'Order to sort', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX type_sort_order_INDEX_idx (type, sort_order), PRIMARY KEY(id)) COMMENT = 'Saves informations of navigation items' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE notification_mail_translation (id INT COMMENT 'Serial number', title VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Notification Title', template TEXT NOT NULL COMMENT 'Notification Template', lang CHAR(5), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE notification_mail (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Notification Identifier Name', renderer VARCHAR(64) DEFAULT 'twig' NOT NULL COMMENT 'Notification Template Renderer', is_enabled TINYINT(1) DEFAULT '1' NOT NULL COMMENT 'Notification Enabled', INDEX is_enabled_INDEX_idx (is_enabled), UNIQUE INDEX name_UNIQUE_idx (name), PRIMARY KEY(id)) COMMENT = 'Saves configuration of notification mail' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE o_auth_admin_token (id INT AUTO_INCREMENT COMMENT 'Serial number', oauth_consumer_id INT NOT NULL COMMENT 'OAuth Consumer id', key_string VARCHAR(16) DEFAULT '' NOT NULL COMMENT 'Key string of this token', secret VARCHAR(32) DEFAULT '' NOT NULL COMMENT 'Secret string of this token', type VARCHAR(255) DEFAULT 'request' COMMENT 'Token type', is_active TINYINT(1) DEFAULT '1' NOT NULL COMMENT 'Activation flag', callback_url TEXT COMMENT 'Callback url', verifier TEXT COMMENT 'Token verifier', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX key_secret_UNIQUE_idx (key_string, secret), INDEX oauth_consumer_id_idx (oauth_consumer_id), PRIMARY KEY(id)) COMMENT = 'Saves administration tokens of OAuth' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE oauth_consumer (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Consumer name', description TEXT COMMENT 'Consumer description', key_string VARCHAR(16) DEFAULT '' NOT NULL COMMENT 'Token for this consumer', secret VARCHAR(32) DEFAULT '' NOT NULL COMMENT 'Password for this consumer', file_id INT COMMENT 'Image file id of this consumer', using_apis LONGTEXT COMMENT 'API list that this consumer uses', member_id INT COMMENT 'Member id', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX key_secret_UNIQUE_idx (key_string, secret), INDEX member_id_idx (member_id), INDEX file_id_idx (file_id), PRIMARY KEY(id)) COMMENT = 'Saves informations of OAuth Consumer' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE o_auth_member_token (id INT AUTO_INCREMENT COMMENT 'Serial number', oauth_consumer_id INT NOT NULL COMMENT 'OAuth Consumer id', key_string VARCHAR(16) DEFAULT '' NOT NULL COMMENT 'Key string of this token', secret VARCHAR(32) DEFAULT '' NOT NULL COMMENT 'Secret string of this token', type VARCHAR(255) DEFAULT 'request' COMMENT 'Token type', is_active TINYINT(1) DEFAULT '1' NOT NULL COMMENT 'Activation flag', callback_url TEXT COMMENT 'Callback url', verifier TEXT COMMENT 'Token verifier', member_id INT COMMENT 'Member id', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX key_secret_UNIQUE_idx (key_string, secret), INDEX oauth_consumer_id_idx (oauth_consumer_id), INDEX member_id_idx (member_id), PRIMARY KEY(id)) COMMENT = 'Saves memebr tokens of OAuth' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE openid_trust_log (id INT AUTO_INCREMENT COMMENT 'Serial number', member_id INT COMMENT 'Member id', uri TEXT COMMENT 'URI for RP', uri_key VARCHAR(32) COMMENT 'Hashed URI for RP', is_permanent TINYINT(1) COMMENT 'A permanent flag', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX uri_key_INDEX_idx (uri_key), INDEX member_id_idx (member_id), PRIMARY KEY(id)) COMMENT = 'Saves logs of trusted OpenID RP' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE plugin (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Nickname', is_enabled TINYINT(1) DEFAULT '1' NOT NULL COMMENT 'Notification Enabled', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX is_enabled_INDEX_idx (is_enabled), UNIQUE INDEX name_UNIQUE_idx (name), PRIMARY KEY(id)) COMMENT = 'Saves informations of plugins' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE profile_translation (id INT COMMENT 'Serial number', caption TEXT NOT NULL COMMENT 'Item name to show', info TEXT COMMENT 'Description', lang CHAR(5), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE profile (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Identified profile name (ASCII)', is_required TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'This is a required', is_unique TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Cannot select duplicate item', is_edit_public_flag TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Settable public flag', default_public_flag TINYINT DEFAULT '1' NOT NULL COMMENT 'Default of public flag', form_type VARCHAR(32) DEFAULT '' NOT NULL COMMENT 'Form type to input/select', value_type VARCHAR(32) DEFAULT '' NOT NULL COMMENT 'Type of input value', is_disp_regist TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Shows when registeration', is_disp_config TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Shows when edit', is_disp_search TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Shows when searching', is_public_web TINYINT(1) DEFAULT '0' NOT NULL COMMENT 'Flag for adding public_flag for publishing to web', value_regexp TEXT COMMENT 'Regular expression', value_min VARCHAR(32) COMMENT 'Minimum value', value_max VARCHAR(32) COMMENT 'Maximum value', sort_order INT COMMENT 'Order to sort', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX name_UNIQUE_idx (name), PRIMARY KEY(id)) COMMENT = 'Saves input/select items for the member profile' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE profile_option_translation (id INT COMMENT 'Serial number', value TEXT COMMENT 'Choice', lang CHAR(5), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE profile_option (id INT AUTO_INCREMENT COMMENT 'Serial number', profile_id INT NOT NULL COMMENT 'Profile id', sort_order INT COMMENT 'Order to sort', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX profile_id_idx (profile_id), PRIMARY KEY(id)) COMMENT = 'Saves options of profile items' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE session (id VARCHAR(128), session_data TEXT COMMENT 'Session information', time TEXT COMMENT 'Timestamp of generated time', PRIMARY KEY(id)) COMMENT = 'Saves session data' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE skin_config (id INT AUTO_INCREMENT COMMENT 'Serial number', plugin VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Plugin name', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Configuration name', value TEXT COMMENT 'Configuration value', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX plugin_name_UNIQUE_idx (plugin, name), PRIMARY KEY(id)) COMMENT = 'Saves configurations of this SNS' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE sns_config (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Configuration name', value TEXT COMMENT 'Configuration value', UNIQUE INDEX name_UNIQUE_idx (name), PRIMARY KEY(id)) COMMENT = 'Saves configurations of this SNS' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE sns_term_translation (id INT COMMENT 'Serial number', value TEXT COMMENT 'Term value', lang CHAR(5), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE sns_term (id INT AUTO_INCREMENT COMMENT 'Serial number', name VARCHAR(64) DEFAULT '' NOT NULL COMMENT 'Term name', application VARCHAR(32) DEFAULT 'pc_frontend' NOT NULL COMMENT 'Application name', INDEX application_INDEX_idx (application), PRIMARY KEY(id)) COMMENT = 'Saves terms of this SNS' DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
ALTER TABLE activity_data ADD CONSTRAINT activity_data_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE activity_data ADD CONSTRAINT activity_data_in_reply_to_activity_id_activity_data_id FOREIGN KEY (in_reply_to_activity_id) REFERENCES activity_data(id) ON DELETE CASCADE;
ALTER TABLE activity_image ADD CONSTRAINT activity_image_file_id_file_id FOREIGN KEY (file_id) REFERENCES file(id) ON DELETE CASCADE;
ALTER TABLE activity_image ADD CONSTRAINT activity_image_activity_data_id_activity_data_id FOREIGN KEY (activity_data_id) REFERENCES activity_data(id) ON DELETE CASCADE;
ALTER TABLE banner_translation ADD CONSTRAINT banner_translation_id_banner_id FOREIGN KEY (id) REFERENCES banner(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE banner_image ADD CONSTRAINT banner_image_file_id_file_id FOREIGN KEY (file_id) REFERENCES file(id) ON DELETE CASCADE;
ALTER TABLE banner_use_image ADD CONSTRAINT banner_use_image_banner_image_id_banner_image_id FOREIGN KEY (banner_image_id) REFERENCES banner_image(id);
ALTER TABLE banner_use_image ADD CONSTRAINT banner_use_image_banner_id_banner_id FOREIGN KEY (banner_id) REFERENCES banner(id);
ALTER TABLE community ADD CONSTRAINT community_file_id_file_id FOREIGN KEY (file_id) REFERENCES file(id) ON DELETE SET NULL;
ALTER TABLE community ADD CONSTRAINT community_community_category_id_community_category_id FOREIGN KEY (community_category_id) REFERENCES community_category(id) ON DELETE SET NULL;
ALTER TABLE community_config ADD CONSTRAINT community_config_community_id_community_id FOREIGN KEY (community_id) REFERENCES community(id) ON DELETE CASCADE;
ALTER TABLE community_member ADD CONSTRAINT community_member_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE community_member ADD CONSTRAINT community_member_community_id_community_id FOREIGN KEY (community_id) REFERENCES community(id) ON DELETE CASCADE;
ALTER TABLE community_member_position ADD CONSTRAINT community_member_position_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE community_member_position ADD CONSTRAINT community_member_position_community_id_community_id FOREIGN KEY (community_id) REFERENCES community(id) ON DELETE CASCADE;
ALTER TABLE community_member_position ADD CONSTRAINT ccci FOREIGN KEY (community_member_id) REFERENCES community_member(id) ON DELETE CASCADE;
ALTER TABLE file_bin ADD CONSTRAINT file_bin_file_id_file_id FOREIGN KEY (file_id) REFERENCES file(id) ON DELETE CASCADE;
ALTER TABLE gadget_config ADD CONSTRAINT gadget_config_gadget_id_gadget_id FOREIGN KEY (gadget_id) REFERENCES gadget(id) ON DELETE CASCADE;
ALTER TABLE member ADD CONSTRAINT member_invite_member_id_member_id FOREIGN KEY (invite_member_id) REFERENCES member(id) ON DELETE SET NULL;
ALTER TABLE member_config ADD CONSTRAINT member_config_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE member_image ADD CONSTRAINT member_image_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE member_image ADD CONSTRAINT member_image_file_id_file_id FOREIGN KEY (file_id) REFERENCES file(id) ON DELETE CASCADE;
ALTER TABLE member_profile ADD CONSTRAINT member_profile_profile_option_id_profile_option_id FOREIGN KEY (profile_option_id) REFERENCES profile_option(id) ON DELETE CASCADE;
ALTER TABLE member_profile ADD CONSTRAINT member_profile_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE CASCADE;
ALTER TABLE member_profile ADD CONSTRAINT member_profile_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE member_relationship ADD CONSTRAINT member_relationship_member_id_to_member_id FOREIGN KEY (member_id_to) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE member_relationship ADD CONSTRAINT member_relationship_member_id_from_member_id FOREIGN KEY (member_id_from) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE navigation_translation ADD CONSTRAINT navigation_translation_id_navigation_id FOREIGN KEY (id) REFERENCES navigation(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE notification_mail_translation ADD CONSTRAINT notification_mail_translation_id_notification_mail_id FOREIGN KEY (id) REFERENCES notification_mail(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE o_auth_admin_token ADD CONSTRAINT o_auth_admin_token_oauth_consumer_id_oauth_consumer_id FOREIGN KEY (oauth_consumer_id) REFERENCES oauth_consumer(id) ON DELETE CASCADE;
ALTER TABLE oauth_consumer ADD CONSTRAINT oauth_consumer_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE oauth_consumer ADD CONSTRAINT oauth_consumer_file_id_file_id FOREIGN KEY (file_id) REFERENCES file(id) ON DELETE SET NULL;
ALTER TABLE o_auth_member_token ADD CONSTRAINT o_auth_member_token_oauth_consumer_id_oauth_consumer_id FOREIGN KEY (oauth_consumer_id) REFERENCES oauth_consumer(id) ON DELETE CASCADE;
ALTER TABLE o_auth_member_token ADD CONSTRAINT o_auth_member_token_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE openid_trust_log ADD CONSTRAINT openid_trust_log_member_id_member_id FOREIGN KEY (member_id) REFERENCES member(id) ON DELETE CASCADE;
ALTER TABLE profile_translation ADD CONSTRAINT profile_translation_id_profile_id FOREIGN KEY (id) REFERENCES profile(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE profile_option_translation ADD CONSTRAINT profile_option_translation_id_profile_option_id FOREIGN KEY (id) REFERENCES profile_option(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE profile_option ADD CONSTRAINT profile_option_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE CASCADE;
ALTER TABLE sns_term_translation ADD CONSTRAINT sns_term_translation_id_sns_term_id FOREIGN KEY (id) REFERENCES sns_term(id) ON UPDATE CASCADE ON DELETE CASCADE;
