text: 
  CREATE TABLE `role` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `description` text COLLATE utf8_unicode_ci NOT NULL,
    `is_group` tinyint(1) NOT NULL DEFAULT '0',
    `is_protected` tinyint(1) NOT NULL DEFAULT '0',
    `parent_id` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `name` (`name`),
    KEY `fk_parent_id_role_idx` (`parent_id`),
    CONSTRAINT `fk_parent_id_role` FOREIGN KEY (`parent_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  
  CREATE TABLE `resource` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `parent_id` int(11) NOT NULL DEFAULT '0',
    `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `name` (`name`),
    KEY `fk_parent_id_resource_idx` (`parent_id`),
    CONSTRAINT `fk_parent_id_resource` FOREIGN KEY (`parent_id`) REFERENCES `resource` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  
  CREATE TABLE `rule` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `role_id` int(11) NOT NULL,
    `resource_id` int(11) NOT NULL,
    `privilege` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_role_id_rule_idx` (`role_id`),
    KEY `fk_resource_id_rule_idx` (`resource_id`),
    CONSTRAINT `fk_resource_id_rule` FOREIGN KEY (`resource_id`) REFERENCES `resource` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    CONSTRAINT `fk_role_id_rule` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  
  CREATE TABLE `user_to_role` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `role_id` int(11) NOT NULL,
    `created` datetime DEFAULT NULL,
    `modified` datetime DEFAULT NULL,
    `deleted` tinyint(1) DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `fk_user_id_user_to_role_idx` (`user_id`),
    KEY `fk_role_id_user_to_role_idx` (`role_id`),
    CONSTRAINT `fk_role_id_user_to_role` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    CONSTRAINT `fk_user_id_user_to_role` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  
  -- Example
  -- CREATE TABLE `user` (
  --   `id` int(11) NOT NULL AUTO_INCREMENT,
  --   PRIMARY KEY (`id`)
  -- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  
  
  INSERT INTO `role` VALUES
  (1,'super_users','Super users',1,1,NULL,NULL,NULL,NULL),
  (2,'administrators','Administrators',1,1,1,NULL,NULL,NULL),
  (3,'members','Members',1,1,2,NULL,NULL,NULL),
  (4,'guests','Guests',1,1,3,NULL,NULL,NULL);
  
  INSERT INTO `resource` VALUES (1,0,'api/v1/countries','',NULL,NULL,NULL);
  
  INSERT INTO `rule` VALUES (1,3,1,'read',NULL,NULL,NULL)