Files
yunzerwebsiteallinone/go/docs/sql/create_cms_product.sql
T
2026-09-15 10:44:31 +08:00

40 lines
1.5 KiB
SQL

-- =============================================================
-- CMS 产品相关表:产品 / 产品分类
-- yz_cms_product 产品
-- yz_cms_product_category 产品分类
-- 可重复执行(CREATE TABLE IF NOT EXISTS)。
-- 运行:mysql -h<host> -P<port> -u<user> -p <db> < create_cms_product.sql
-- =============================================================
CREATE TABLE IF NOT EXISTS `yz_cms_product` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`tid` bigint unsigned NOT NULL DEFAULT 0,
`title` varchar(100) NOT NULL DEFAULT '',
`thumb` varchar(500) NOT NULL DEFAULT '',
`desc` varchar(500) NOT NULL DEFAULT '',
`content` mediumtext,
`url` 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_status` (`tid`,`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `yz_cms_product_category` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`tid` bigint unsigned NOT NULL DEFAULT 0,
`title` varchar(100) NOT NULL DEFAULT '',
`pid` bigint unsigned NOT NULL DEFAULT 0,
`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_pid` (`tid`,`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;