 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `permission` (
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
-  `user_id` int(11) unsigned DEFAULT NULL,
+  `role_id` smallint(6) unsigned DEFAULT NULL,
+  `status_id` smallint(6) unsigned DEFAULT NULL,
   `main_menu_id` smallint(4) unsigned DEFAULT NULL,
   `submenu_id` smallint(4) unsigned DEFAULT NULL,
-  `create` bit(1) NOT NULL DEFAULT b'1',
-  `update` bit(1) NOT NULL DEFAULT b'1',
   `view` bit(1) NOT NULL DEFAULT b'1',
-  `delete` bit(1) NOT NULL DEFAULT b'1',
-  PRIMARY KEY (`id`),
-  KEY `fk_permission_user_id_idx` (`user_id`),
+  `list` bit(1) NOT NULL DEFAULT b'1',
+  `update` bit(1) NOT NULL DEFAULT b'0',
+  `create` bit(1) NOT NULL DEFAULT b'0',
+  `delete` bit(1) NOT NULL DEFAULT b'0',
+  PRIMARY KEY (`id`),
   KEY `fk_permission_main_menu_id_idx` (`main_menu_id`),
   KEY `fk_permission_submenu_id_idx` (`submenu_id`),
+  KEY `fk_permission_role_id_idx` (`role_id`),
+  KEY `fk_permission_status_id_idx` (`status_id`),
   CONSTRAINT `fk_permission_main_menu_id` FOREIGN KEY (`main_menu_id`) REFERENCES `main_menu` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
-  CONSTRAINT `fk_permission_submenu_id` FOREIGN KEY (`submenu_id`) REFERENCES `submenu` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
-  CONSTRAINT `fk_permission_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
+  CONSTRAINT `fk_permission_role_id` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+  CONSTRAINT `fk_permission_status_id` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+  CONSTRAINT `fk_permission_submenu_id` FOREIGN KEY (`submenu_id`) REFERENCES `submenu` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 /*!40101 SET character_set_client = @saved_cs_client */;
 

UNLOCK TABLES;

--
-- Table structure for table `gender`
--


/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2015-10-15 17:42:18
