|
楼主 |
发表于 2009-3-17 16:33:21
|
显示全部楼层
PHP复制代码
--
-- 表的结构 `groups`
--
CREATE TABLE IF NOT EXISTS `groups` (
`id` int (11) unsigned NOT NULL auto_increment ,
`groupname` varchar (32) NOT NULL,
`description` varchar (96) NOT NULL,
`sort_id` int (10) unsigned NOT NULL default '0',
PRIMARY KEY (`id` ),
UNIQUE KEY `uniq_groupname` (`groupname` )
) ENGINE =InnoDB DEFAULT CHARSET =utf8 AUTO_INCREMENT =3 ;
--
-- 导出表中的数据 `groups`
--
INSERT INTO `groups` (`id` , `groupname` , `description` , `sort_id` ) VALUES
(1, '组一', '', 0),
(2, '组二', '', 0);
-- --------------------------------------------------------
--
-- 表的结构 `groups_users`
--
CREATE TABLE IF NOT EXISTS `groups_users` (
`user_id` smallint (5) unsigned NOT NULL,
`group_id` tinyint (3) unsigned NOT NULL,
PRIMARY KEY (`user_id` ,`group_id` ),
KEY `fk_group_id` (`group_id` ),
KEY `fk_user_id` (`user_id` )
) ENGINE =InnoDB DEFAULT CHARSET =utf8 ;
--
-- 导出表中的数据 `groups_users`
--
INSERT INTO `groups_users` (`user_id` , `group_id` ) VALUES
(1, 1),
(1, 2);
-- --------------------------------------------------------
--
-- 表的结构 `roles`
--
CREATE TABLE IF NOT EXISTS `roles` (
`id` int (11) unsigned NOT NULL auto_increment ,
`parent_id` int (11) unsigned NOT NULL default '0',
`rolename` varchar (32) NOT NULL,
`controller` varchar (32) NOT NULL,
` function` varchar (32) NOT NULL,
`sort_id` int (10) unsigned NOT NULL default '0',
`description` varchar (255) NOT NULL,
PRIMARY KEY (`id` ),
UNIQUE KEY `uniq_rolename` (`rolename` )
) ENGINE =InnoDB DEFAULT CHARSET =utf8 AUTO_INCREMENT =5 ;
--
-- 导出表中的数据 `roles`
--
INSERT INTO `roles` (`id` , `parent_id` , `rolename` , `controller` , ` function` , `sort_id` , `description` ) VALUES
(1, 0, '基本功能', '', '', 0, ''),
(2, 1, '登录', 'user', 'login', 0, ''),
(3, 1, '修改密码', 'user', 'password', 0, ''),
(4, 2, '超级登录', 'user', 'supper', 0, '');
-- --------------------------------------------------------
--
-- 表的结构 `roles_users`
--
CREATE TABLE IF NOT EXISTS `roles_users` (
`user_id` smallint (5) unsigned NOT NULL,
`role_id` tinyint (3) unsigned NOT NULL,
PRIMARY KEY (`user_id` ,`role_id` ),
KEY `fk_role_id` (`role_id` )
) ENGINE =InnoDB DEFAULT CHARSET =utf8 ;
--
-- 导出表中的数据 `roles_users`
--
INSERT INTO `roles_users` (`user_id` , `role_id` ) VALUES
(1, 2),
(1, 3);
-- --------------------------------------------------------
--
-- 表的结构 `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int (11) unsigned NOT NULL auto_increment ,
`username` varchar (32) NOT NULL,
`password` char (32) NOT NULL,
`sort_id` int (10) unsigned NOT NULL default '0',
`created` datetime default NULL,
`updated` datetime default NULL,
PRIMARY KEY (`id` ),
UNIQUE KEY `uniq_username` (`username` )
) ENGINE =InnoDB DEFAULT CHARSET =utf8 AUTO_INCREMENT =4 ;
--
-- 导出表中的数据 `users`
--
INSERT INTO `users` (`id` , `username` , `password` , `sort_id` , `created` , `updated` ) VALUES
(1, 'pat', '', 0, NULL, NULL),
(2, 'pat2', '', 0, NULL, NULL),
(3, 'pat3', '', 0, NULL, NULL);
复制代码 |
|