CREATE TABLE `permissions` ( `id` int PRIMARY KEY, `name` varchar(255) ); CREATE TABLE `users_roles` ( `users_id` int, `roles_id` int, `` varchar(255), FOREIGN KEY(`users_id`) REFERENCES `users` (`id`), FOREIGN KEY(`roles_id`) REFERENCES `roles` (`id`) ); CREATE TABLE `roles` ( `id` int PRIMARY KEY, `name` varchar(255) ); CREATE TABLE `roles_permissions` ( `roles_id` int, `permissions_id` int, FOREIGN KEY(`roles_id`) REFERENCES `roles` (`id`), FOREIGN KEY(`permissions_id`) REFERENCES `permissions` (`id`) ); CREATE TABLE `users` ( `id` int PRIMARY KEY, `name` varchar(255) );