常见模块设计--权限管理(auth)
DROP TABLE IF EXISTS tky_auth_role;
CREATE TABLE tky_auth_role (
roleid MEDIUMINT (8) UNSIGNED NOT NULL auto_increment COMMENT '编号',
title CHAR (30) NOT NULL DEFAULT '' COMMENT '名称',
status TINYINT (1) NOT NULL DEFAULT '1' COMMENT '状态',
rules text COMMENT '规则',
PRIMARY KEY (roleid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT = '角色';
DROP TABLE IF EXISTS tky_auth_role_member;
CREATE TABLE tky_auth_role_member (
uid MEDIUMINT (8) UNSIGNED NOT NULL DEFAULT '0' COMMENT '用户编号',
roleid MEDIUMINT (8) UNSIGNED NOT NULL DEFAULT '0' COMMENT '组编号',
UNIQUE KEY uid_role_id (uid, roleid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT = '用户角色';
DROP TABLE IF EXISTS tky_auth_rule;
CREATE TABLE tky_auth_rule (
ruleid MEDIUMINT (8) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '编号',
module VARCHAR (20) NOT NULL DEFAULT '' COMMENT '规则所属module',
type TINYINT (1) NOT NULL DEFAULT '1' COMMENT '类型 1-url;2-主菜单',
name CHAR (80) NOT NULL DEFAULT '' COMMENT '规则唯一英文标识',
title CHAR (20) NOT NULL DEFAULT '' COMMENT '规则中文描述',
regex CHAR (100) NOT NULL DEFAULT '' COMMENT '规则表达式',
status TINYINT (1) NOT NULL DEFAULT '1' COMMENT '状态',
PRIMARY KEY (ruleid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT = '规则表';