How to design a dictionary table in the database to store type data, it needs to be edited, how do everyone do it
CREATE TABLE `t_ci` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`parentId` bigint(20) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL COMMENT '名称',
`seq` int(11) DEFAULT NULL COMMENT '序号',
`hasChild` int(11) DEFAULT NULL COMMENT '是否有子配置',
`property` varchar(32) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=155 DEFAULT CHARSET=utf8 COMMENT='配置表' |
The above is one way,
CREATE TABLE dictionary_type` (
`ID` varchar(255) NOT NULL COMMENT '主键',
`CODE` varchar(255) DEFAULT NULL COMMENT '编码',
`STATUS` int(11) DEFAULT NULL COMMENT '状态',
`TEXT` varchar(255) DEFAULT NULL COMMENT '字典类型名称',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='字典类型表'
CREATE TABLE `dictionary_item` (
`ID` varchar(255) NOT NULL COMMENT '主键',
`SORT` int(11) DEFAULT NULL COMMENT '序号',
`TEXT` varchar(255) DEFAULT NULL COMMENT '字典内容',
`VALUE` int(11) DEFAULT NULL COMMENT '值',
`TYPE_ID` varchar(255) DEFAULT NULL COMMENT '类型ID',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='字典类型条目表'
This is the second way
. Which of these two ways is better, and is there any other way?