create table if not exists `cnt_{DB}` (
	`uid`			int unsigned not null auto_increment,
	`member_uid`	int unsigned default '0' comment 'sys_member.uid',
	`name`			varchar(100),
	`url`			varchar(255) comment 'human readable url',
	`tag`			varchar(255),
	`category`		varchar(100),
	`option`		varchar(255) comment 'delimeter',
	`title`			varchar(255),
	`cmt_count`		int unsigned default '0' comment 'comment count',
	`read_count`	int unsigned default '0',
	`file_count`	tinyint unsigned default '0',
	`content`		longtext,
	`content_type`	varchar(10) not null default 'html' comment 'html/text',
	`abstract`		varchar(500) comment 'abstract for seo description, etc',
	`created_at`	datetime DEFAULT CURRENT_TIMESTAMP,
	`updated_at`	datetime DEFAULT CURRENT_TIMESTAMP,
	primary key (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

create table if not exists `cmt_{DB}` (
	`uid`			int unsigned not null auto_increment,
	`cnt_uid`		int unsigned default '0' comment 'cnt_uid',
	`member_uid`	int unsigned default '0' comment 'sys_member.uid',
	`name`			varchar(100),
	`content`		mediumtext,
	`file_count`	tinyint unsigned default '0',
	`created_at`	datetime DEFAULT CURRENT_TIMESTAMP,
	primary key (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

create table if not exists `bbs_option` (
	`uid`			int unsigned not null auto_increment,
	`bbs_id`		varchar(100) not null,
	`skin`			varchar(20) not null default 'default',
	`pagerow`		tinyint unsigned not null default '10',
	`use_option`	varchar(255) comment 'delimeter |',
	`show_option`	varchar(255) comment 'delimeter |',
	`category`		json,
	`max_img_width`	int unsigned not null default '0',
	`max_img_height`	int unsigned not null default '0',
	primary key (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

create table if not exists `bbs_file` (
    `uid`       int unsigned auto_increment,
    `type`      varchar(4) comment 'File Category: HD|INLN, etc',
    `sort`      tinyint unsigned not null default '0',
    `name`      varchar(255),
    `realname`  varchar(255),
    `download_count`  int unsigned not null default '0',
    `path`      varchar(255) comment 'relative path to file root (files)',
    `ext`       char(4),
    `size`      int unsigned not null default '0',
    `tbl`       varchar(100),
    `idx`       int unsigned not null default '0',
    `description`   varchar(255),
    `show`      tinyint unsigned not null default '1',
    primary key(`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
