50 lines
1.9 KiB
SQL
50 lines
1.9 KiB
SQL
-- =============================================================
|
|
-- CMS 文章相关表:文章分类 / 文章
|
|
-- yz_cms_article_category 文章分类
|
|
-- yz_cms_article 文章
|
|
-- 可重复执行(CREATE TABLE IF NOT EXISTS)。
|
|
-- 运行:mysql -h<host> -P<port> -u<user> -p <db> < create_cms_article.sql
|
|
-- =============================================================
|
|
|
|
CREATE TABLE IF NOT EXISTS `yz_cms_article_category` (
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
`tid` bigint unsigned NOT NULL DEFAULT 0,
|
|
`cid` bigint unsigned NOT NULL DEFAULT 0,
|
|
`name` varchar(100) NOT NULL DEFAULT '',
|
|
`image` varchar(500) NOT NULL DEFAULT '',
|
|
`desc` varchar(500) NOT NULL DEFAULT '',
|
|
`sort` int NOT NULL DEFAULT 0,
|
|
`status` tinyint NOT NULL DEFAULT 1,
|
|
`create_time` datetime NOT NULL,
|
|
`update_time` datetime DEFAULT NULL,
|
|
`delete_time` datetime DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `idx_tid_cid` (`tid`,`cid`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
CREATE TABLE IF NOT EXISTS `yz_cms_article` (
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
|
`tid` bigint unsigned NOT NULL DEFAULT 0,
|
|
`title` varchar(255) NOT NULL DEFAULT '',
|
|
`author` varchar(100) NOT NULL DEFAULT '',
|
|
`cate_id` bigint unsigned NOT NULL DEFAULT 0,
|
|
`content` mediumtext,
|
|
`desc` varchar(500) NOT NULL DEFAULT '',
|
|
`image` varchar(500) NOT NULL DEFAULT '',
|
|
`is_trans` tinyint NOT NULL DEFAULT 0,
|
|
`transurl` varchar(500) DEFAULT NULL,
|
|
`status` tinyint NOT NULL DEFAULT 0,
|
|
`top` tinyint NOT NULL DEFAULT 0,
|
|
`recommend` tinyint NOT NULL DEFAULT 0,
|
|
`views` int NOT NULL DEFAULT 0,
|
|
`likes` int NOT NULL DEFAULT 0,
|
|
`publisher_id` bigint unsigned DEFAULT NULL,
|
|
`publish_time` datetime DEFAULT NULL,
|
|
`create_time` datetime NOT NULL,
|
|
`update_time` datetime DEFAULT NULL,
|
|
`delete_time` datetime DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `idx_tid_status` (`tid`,`status`),
|
|
KEY `idx_cate_id` (`cate_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|