#
# news - MySQL structur
#
# mysql_structur.sql
#


# table structur for table 'board_config'
#
CREATE TABLE board_config (
	cfg_name VARCHAR(255) NOT NULL,
	cfg_value VARCHAR(255) NOT NULL,
	PRIMARY KEY (cfg_name)
);

# table structur for table 'board_categories'
#
CREATE TABLE board_main_categories (
	mcat_id TINYINT(4) DEFAULT '0' NOT NULL AUTO_INCREMENT,
	mcat_name VARCHAR(64) NOT NULL,
	PRIMARY KEY (mcat_id)
);

# table structur for table 'board_sub_categories'
#
CREATE TABLE board_sub_categories (
	scat_id TINYINT(6) DEFAULT '0' NOT NULL AUTO_INCREMENT,
	mcat_id TINYINT(4) NOT NULL,	
	scat_name VARCHAR(64) NOT NULL,
	scat_text TINYTEXT NOT NULL,
	PRIMARY KEY (scat_id)
);

# table structur for table 'board_posters'
#
CREATE TABLE board_posters (
	poster_id MEDIUMINT(8) DEFAULT '0' NOT NULL AUTO_INCREMENT,
	poster_name VARCHAR(64) NOT NULL,
	poster_pwd VARCHAR(31) NOT NULL,
	poster_mail VARCHAR(127) NOT NULL,
	poster_icq VARCHAR(16) NOT NULL,
	poster_aim VARCHAR(25) NOT NULL,
	poster_msn VARCHAR(25) NOT NULL,
	poster_yahoo VARCHAR(25) NOT NULL,
	poster_jabber VARCHAR(25) NOT NULL,
	poster_web VARCHAR(40) NOT NULL,
	poster_residence VARCHAR(50) NOT NULL,
	poster_signature VARCHAR(255) NOT NULL,
	poster_template VARCHAR(50) NOT NULL,
	poster_language VARCHAR(30) NOT NULL,
	poster_enable_bbcode TINYINT(1) DEFAULT '0' NOT NULL,
	poster_enable_html TINYINT(1) DEFAULT '0' NOT NULL,
	poster_enable_smilies TINYINT(1) DEFAULT '0' NOT NULL,
	poster_time_format VARCHAR(20) NOT NULL,
	poster_time_zone VARCHAR(5) NOT NULL,
	poster_rank TINYINT(2) DEFAULT '0' NOT NULL,
	poster_locked TINYINT(1) DEFAULT '0' NOT NULL,
	PRIMARY KEY (poster_id)
);

# table structur for table 'board_ranks'
#
CREATE TABLE board_ranks (
	rank_id MEDIUMINT(8) DEFAULT '0' NOT NULL AUTO_INCREMENT,
	rank_name VARCHAR(255) NOT NULL,
	PRIMARY KEY (rank_id)
);

# table structur for table 'board_posts'
#
CREATE TABLE board_posts (
	post_id INT DEFAULT '0' NOT NULL AUTO_INCREMENT,
	rel_id INT DEFAULT '0' NOT NULL,
	scat_id TINYINT(6) DEFAULT '0' NOT NULL,
	poster_id MEDIUMINT(8)  DEFAULT '0' NOT NULL,
	post_title VARCHAR(64) NOT NULL,
	post_text TEXT NOT NULL,
	post_time INT(14) NOT NULL,
	last_post_time INT(14) NOT NULL,
	enable_comments TINYINT(1) DEFAULT '1' NOT NULL,
	enable_bbcode TINYINT(1) DEFAULT '1' NOT NULL,
	enable_html TINYINT(1) DEFAULT '0' NOT NULL,
	enable_smilies TINYINT(1) DEFAULT '1' NOT NULL,
	PRIMARY KEY (post_id)
);

# table structur for table 'board_cat_mods'
#
CREATE TABLE board_cat_mods (
	scat_id TINYINT(6) NOT NULL,
	poster_id MEDIUMINT(8) NOT NULL
);

# table structur for table 'board_smilies'
#
CREATE TABLE board_smilies (
	smy_id MEDIUMINT(8) DEFAULT '0'NOT NULL AUTO_INCREMENT,
	smy_code VARCHAR(31) NOT NULL,
	smy_url VARCHAR(255) NOT NULL,
	PRIMARY KEY (smy_id)
);

# table structur for table 'email_list'
#
CREATE TABLE board_email_list (
	post_id TINYINT(6) NOT NULL,
	poster_id MEDIUMINT(8) NOT NULL
);

# table structur for table 'message'
#
CREATE TABLE board_message (
	message_id TINYINT(6) NOT NULL,
	user_id MEDIUMINT(8) NOT NULL,
	sender_id MEDIUMINT(8) NOT NULL,
	message_text TEXT NOT NULL,
	message_time INT(14) NOT NULL,
	message_status TINYINT(1) DEFAULT '0' NOT NULL,
	PRIMARY KEY (message_id)	
);
