parent
d43c622020
commit
13d34d920b
@ -1,17 +1,23 @@
|
||||
-- 创建DB
|
||||
create database if not exists `indie_tag` default charset utf8mb4 collate utf8mb4_general_ci;
|
||||
use indie_tag;
|
||||
-- 创建表
|
||||
drop table if exists indie_tag.tb_tag;
|
||||
create table indie_tag.tb_tag (
|
||||
id varchar(100) not null primary key comment '标签ID',
|
||||
parent_id varchar(100) not null default '' comment '父标签ID(一级标签的父标签ID=空字符串)',
|
||||
name_ch varchar(100) not null default '' comment '标签中文名称',
|
||||
name_en varchar(100) not null default '' comment '标签英文名称',
|
||||
state tinyint not null default 1 comment '状态(0=禁用,1=启用)',
|
||||
creator_id int default 0 comment '创建人用户ID',
|
||||
create_time datetime default current_timestamp comment '创建时间',
|
||||
update_time datetime default current_timestamp on update current_timestamp comment '更新时间',
|
||||
key idx_update_time(update_time),
|
||||
key idx_parent_id(parent_id)
|
||||
) character set utf8mb4 comment '标签表';
|
||||
drop table if exists indie_music.tb_tag_info;
|
||||
create table if not exists indie_music.tb_tag_info
|
||||
(
|
||||
id varchar(100) not null comment '标签ID'
|
||||
primary key,
|
||||
level tinyint(2) default 1 not null comment '层级(1=一级, 2=二级)',
|
||||
parent_id varchar(100) default '' not null comment '父标签ID(一级标签的父标签ID=空字符串)',
|
||||
name_ch varchar(100) default '' not null comment '标签中文名称',
|
||||
name_en varchar(100) default '' not null comment '标签英文名称',
|
||||
state tinyint(2) default 1 not null comment '状态(0=禁用,1=启用)',
|
||||
creator_id varchar(64) default '' not null comment '创建人用户ID',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
||||
updater_id varchar(64) default '' not null comment '更新用户ID',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间'
|
||||
)
|
||||
comment '标签表';
|
||||
|
||||
create index idx_parent_id
|
||||
on indie_music.tb_tag_info (parent_id);
|
||||
|
||||
create index idx_create_time
|
||||
on indie_music.tb_tag_info (create_time);
|
||||
|
Loading…
Reference in new issue