# ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 95.142.155.136 (MySQL 5.6.35)
# Database: brighton_arc_cms
# Generation Time: 2017-12-12 14:41:32 +0000
# ************************************************************


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


# Dump of table content
# ------------------------------------------------------------

CREATE TABLE `content` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content_block_id` int(11) NOT NULL,
  `updated_user_id` int(11) NOT NULL,
  `published_user_id` int(11) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `published` datetime DEFAULT NULL,
  `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 - Mark-up\n1 - Block\n',
  `content` text,
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0 - Archive\n1 - Pending Approval\n2 - Published\n',
  PRIMARY KEY (`id`),
  KEY `fk_content_content_block1_idx` (`content_block_id`),
  KEY `fk_content_user1_idx` (`updated_user_id`),
  KEY `fk_content_user2_idx` (`published_user_id`),
  CONSTRAINT `fk_content_content_block1` FOREIGN KEY (`content_block_id`) REFERENCES `content_block` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_content_user1` FOREIGN KEY (`updated_user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_content_user2` FOREIGN KEY (`published_user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table content_block
# ------------------------------------------------------------

CREATE TABLE `content_block` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `created_user_id` int(11) NOT NULL,
  `markup_key` varchar(45) NOT NULL,
  `created` datetime DEFAULT NULL,
  `name` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_markup_key` (`markup_key`),
  KEY `fk_content_block_user1_idx` (`created_user_id`),
  CONSTRAINT `fk_content_block_user1` FOREIGN KEY (`created_user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table content_block_page
# ------------------------------------------------------------

CREATE TABLE `content_block_page` (
  `page_id` int(11) NOT NULL,
  `content_block_id` int(11) NOT NULL,
  `position` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`page_id`,`content_block_id`),
  KEY `fk_content_block_page_content_block1_idx` (`content_block_id`),
  KEY `idx_position` (`position`),
  CONSTRAINT `fk_content_block_page_content_block1` FOREIGN KEY (`content_block_id`) REFERENCES `content_block` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_content_block_page_page1` FOREIGN KEY (`page_id`) REFERENCES `page` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table content_block_setting
# ------------------------------------------------------------

CREATE TABLE `content_block_setting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `name` varchar(45) NOT NULL,
  `settings` text,
  PRIMARY KEY (`id`),
  KEY `fk_block_setting_site1_idx` (`site_id`),
  CONSTRAINT `fk_block_setting_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table content_update
# ------------------------------------------------------------

CREATE TABLE `content_update` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table event
# ------------------------------------------------------------

CREATE TABLE `event` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `event_type_id` int(11) NOT NULL,
  `event_id` varchar(20) NOT NULL,
  `title` varchar(100) NOT NULL,
  `page_title` varchar(100) DEFAULT NULL,
  `sub_title` varchar(100) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `description` text,
  `slug` varchar(100) DEFAULT NULL,
  `ticket_url` varchar(500) DEFAULT NULL,
  `event_info_link` varchar(100) DEFAULT NULL,
  `race_day` tinyint(4) NOT NULL DEFAULT '0',
  `featured` tinyint(4) NOT NULL DEFAULT '0',
  `active` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `fk_event_site1_idx` (`site_id`),
  KEY `idx_slug` (`slug`),
  KEY `fk_event_event_type1_idx` (`event_type_id`),
  KEY `idx_ems_event_id` (`event_id`),
  CONSTRAINT `fk_event_event_type1` FOREIGN KEY (`event_type_id`) REFERENCES `event_type` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_event_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table event_image
# ------------------------------------------------------------

CREATE TABLE `event_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `image_id` int(11) NOT NULL,
  `event_id` int(11) NOT NULL,
  `type` int(11) NOT NULL DEFAULT '0' COMMENT '0 - Hero\n1 - Thumbnail\n2 - Sponsor',
  PRIMARY KEY (`id`),
  KEY `fk_event_image_image1_idx` (`image_id`),
  KEY `fk_event_image_event1_idx` (`event_id`),
  CONSTRAINT `fk_event_image_event1` FOREIGN KEY (`event_id`) REFERENCES `event` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_event_image_image1` FOREIGN KEY (`image_id`) REFERENCES `image` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table event_non_race_day
# ------------------------------------------------------------

CREATE TABLE `event_non_race_day` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `event_id` int(11) NOT NULL,
  `open_time` time DEFAULT NULL,
  `start_time` time DEFAULT NULL,
  `finish_time` time DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_event-non-race-day_event1_idx` (`event_id`),
  CONSTRAINT `fk_event-non-race-day_event1` FOREIGN KEY (`event_id`) REFERENCES `event` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table event_race_day
# ------------------------------------------------------------

CREATE TABLE `event_race_day` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `event_id` int(11) NOT NULL,
  `gates_open` time DEFAULT NULL,
  `first_race` time DEFAULT NULL,
  `last_race` time DEFAULT NULL,
  `race_type` int(11) NOT NULL DEFAULT '0' COMMENT '0 - Flat\n1 - Jump',
  `races` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_event-race-day_event1_idx` (`event_id`),
  CONSTRAINT `fk_event-race-day_event1` FOREIGN KEY (`event_id`) REFERENCES `event` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table event_type
# ------------------------------------------------------------

CREATE TABLE `event_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table facility
# ------------------------------------------------------------

CREATE TABLE `facility` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(45) NOT NULL,
  `wifi` tinyint(1) NOT NULL DEFAULT '0',
  `av_system` tinyint(1) NOT NULL DEFAULT '0',
  `telephone_points` tinyint(1) NOT NULL DEFAULT '0',
  `bar` tinyint(1) NOT NULL DEFAULT '0',
  `walk_in` tinyint(1) NOT NULL DEFAULT '0',
  `pre_book` tinyint(1) NOT NULL DEFAULT '0',
  `notes` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table facility_capacity
# ------------------------------------------------------------

CREATE TABLE `facility_capacity` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `facility_id` int(11) NOT NULL,
  `facility_layout_id` int(11) NOT NULL,
  `capacity` int(11) NOT NULL DEFAULT '0',
  `projection_type` enum('np','bp','fp') NOT NULL DEFAULT 'np' COMMENT 'np - No Projection\nbp - Back Projection\nfp - Front Projection',
  `notes` text,
  PRIMARY KEY (`id`),
  KEY `fk_facility_capacity_facility1_idx` (`facility_id`),
  KEY `fk_facility_capacity_facility_layout1_idx` (`facility_layout_id`),
  CONSTRAINT `fk_facility_capacity_facility1` FOREIGN KEY (`facility_id`) REFERENCES `facility` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_facility_capacity_facility_layout1` FOREIGN KEY (`facility_layout_id`) REFERENCES `facility_layout` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table facility_category
# ------------------------------------------------------------

CREATE TABLE `facility_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table facility_facility_use
# ------------------------------------------------------------

CREATE TABLE `facility_facility_use` (
  `facility_id` int(11) NOT NULL,
  `facility_use_id` int(11) NOT NULL,
  `facility_category_id` int(11) NOT NULL,
  `notes` text,
  PRIMARY KEY (`facility_id`,`facility_use_id`),
  KEY `fk_facility_facility_use_facility_use1_idx` (`facility_use_id`),
  KEY `fk_facility_facility_use_facility1_idx` (`facility_id`),
  KEY `fk_facility_facility_use_facility_category1_idx` (`facility_category_id`),
  CONSTRAINT `fk_facility_facility_use_facility1` FOREIGN KEY (`facility_id`) REFERENCES `facility` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_facility_facility_use_facility_category1` FOREIGN KEY (`facility_category_id`) REFERENCES `facility_category` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_facility_facility_use_facility_use1` FOREIGN KEY (`facility_use_id`) REFERENCES `facility_use` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table facility_layout
# ------------------------------------------------------------

CREATE TABLE `facility_layout` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table facility_unique_selling_point
# ------------------------------------------------------------

CREATE TABLE `facility_unique_selling_point` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `facility_id` int(11) NOT NULL,
  `description` text,
  PRIMARY KEY (`id`),
  KEY `fk_unique_selling_point_facility1_idx` (`facility_id`),
  CONSTRAINT `fk_unique_selling_point_facility1` FOREIGN KEY (`facility_id`) REFERENCES `facility` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table facility_use
# ------------------------------------------------------------

CREATE TABLE `facility_use` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table file
# ------------------------------------------------------------

CREATE TABLE `file` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `title` varchar(200) DEFAULT NULL,
  `uploaded` datetime NOT NULL,
  `original_filename` varchar(200) NOT NULL,
  `extension` varchar(5) NOT NULL,
  `size` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_image_site1_idx` (`site_id`),
  KEY `fk_image_user1_idx` (`user_id`),
  CONSTRAINT `fk_image_site10` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_image_user10` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table image
# ------------------------------------------------------------

CREATE TABLE `image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `title` varchar(200) DEFAULT NULL,
  `uploaded` datetime NOT NULL,
  `original_filename` varchar(200) NOT NULL,
  `thumbnail_filename` varchar(200) NOT NULL,
  `extension` varchar(5) NOT NULL,
  `width` int(11) DEFAULT NULL,
  `height` int(11) DEFAULT NULL,
  `size` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_image_site1_idx` (`site_id`),
  KEY `fk_image_user1_idx` (`user_id`),
  CONSTRAINT `fk_image_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_image_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table news_article
# ------------------------------------------------------------

CREATE TABLE `news_article` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `site_user_id` int(11) NOT NULL,
  `news_article_category_id` int(11) NOT NULL,
  `image_id` int(11) NOT NULL,
  `created_date` datetime NOT NULL,
  `published_date` datetime DEFAULT NULL,
  `title` varchar(80) NOT NULL,
  `slug` varchar(80) NOT NULL,
  `content` mediumtext NOT NULL,
  `published` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `fk_news_article_news_article_category1_idx` (`news_article_category_id`),
  KEY `fk_news_article_image1_idx` (`image_id`),
  KEY `fk_news_article_site_user1_idx` (`site_user_id`),
  KEY `fk_news_article_site1_idx` (`site_id`),
  CONSTRAINT `fk_news_article_image1` FOREIGN KEY (`image_id`) REFERENCES `image` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_news_article_news_article_category1` FOREIGN KEY (`news_article_category_id`) REFERENCES `news_article_category` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_news_article_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_news_article_site_user1` FOREIGN KEY (`site_user_id`) REFERENCES `site_user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table news_article_category
# ------------------------------------------------------------

CREATE TABLE `news_article_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `title` varchar(25) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_news_article_category_site1_idx` (`site_id`),
  CONSTRAINT `fk_news_article_category_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table notification
# ------------------------------------------------------------

CREATE TABLE `notification` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `message_added` date NOT NULL,
  `message` varchar(200) NOT NULL,
  `expiry_date` date NOT NULL,
  `active` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `fk_table1_site1_idx` (`site_id`),
  KEY `fk_notification_user1_idx` (`user_id`),
  CONSTRAINT `fk_notification_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_table1_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table package
# ------------------------------------------------------------

CREATE TABLE `package` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `event_id` int(11) NOT NULL,
  `package_type_id` int(11) NOT NULL,
  `package_id` varchar(20) NOT NULL,
  `name` varchar(100) NOT NULL,
  `description` text,
  `price` decimal(13,4) NOT NULL,
  `created` int(11) NOT NULL,
  `modified` int(11) NOT NULL,
  `featured` tinyint(4) NOT NULL DEFAULT '0',
  `active` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `fk_package_package_type1_idx` (`package_type_id`),
  KEY `fk_package_event1_idx` (`event_id`),
  KEY `idx_package_id` (`package_id`),
  CONSTRAINT `fk_package_event1` FOREIGN KEY (`event_id`) REFERENCES `event` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_package_package_type1` FOREIGN KEY (`package_type_id`) REFERENCES `package_type` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table package_type
# ------------------------------------------------------------

CREATE TABLE `package_type` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `package_type_id` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_package_type_id` (`package_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table page
# ------------------------------------------------------------

CREATE TABLE `page` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `image_id` int(11) DEFAULT '0',
  `title` varchar(50) DEFAULT NULL,
  `name` varchar(200) NOT NULL,
  `description` text,
  `cache` text,
  `parent_page_id` int(11) NOT NULL DEFAULT '0',
  `previous_page_id` int(11) NOT NULL DEFAULT '0',
  `next_page_id` int(11) NOT NULL DEFAULT '0',
  `sitemap_priority` float NOT NULL DEFAULT '0',
  `sitemap_frequency` varchar(10) NOT NULL COMMENT '''always'', ''hourly'', ''daily'', ''weekly'', ''monthly'', ''yearly'', ''never''',
  `sitemap_lastmod` datetime DEFAULT NULL,
  `menu_order` int(11) NOT NULL DEFAULT '0',
  `include_on_menu` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `idx_page_name` (`name`),
  KEY `fk_page_site1_idx` (`site_id`),
  KEY `idx_parent_page_id` (`parent_page_id`),
  KEY `idx_previous_page_id` (`previous_page_id`),
  KEY `idx_next_page_id` (`next_page_id`),
  KEY `idx_menu_order` (`menu_order`),
  KEY `fk_page_image1_idx` (`image_id`),
  CONSTRAINT `fk_page_image1` FOREIGN KEY (`image_id`) REFERENCES `image` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_page_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table rbac_permissions
# ------------------------------------------------------------

CREATE TABLE `rbac_permissions` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Lft` int(11) NOT NULL,
  `Rght` int(11) NOT NULL,
  `Title` char(64) COLLATE utf8_bin NOT NULL,
  `Description` text COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `Title` (`Title`),
  KEY `Lft` (`Lft`),
  KEY `Rght` (`Rght`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;



# Dump of table rbac_rolepermissions
# ------------------------------------------------------------

CREATE TABLE `rbac_rolepermissions` (
  `RoleID` int(11) NOT NULL,
  `PermissionID` int(11) NOT NULL,
  `AssignmentDate` int(11) NOT NULL,
  PRIMARY KEY (`RoleID`,`PermissionID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;



# Dump of table rbac_roles
# ------------------------------------------------------------

CREATE TABLE `rbac_roles` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Lft` int(11) NOT NULL,
  `Rght` int(11) NOT NULL,
  `Title` varchar(128) COLLATE utf8_bin NOT NULL,
  `Description` text COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `Title` (`Title`),
  KEY `Lft` (`Lft`),
  KEY `Rght` (`Rght`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;



# Dump of table rbac_userroles
# ------------------------------------------------------------

CREATE TABLE `rbac_userroles` (
  `UserID` int(11) NOT NULL,
  `RoleID` int(11) NOT NULL,
  `AssignmentDate` int(11) NOT NULL,
  PRIMARY KEY (`UserID`,`RoleID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;



# Dump of table site
# ------------------------------------------------------------

CREATE TABLE `site` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `template_dir` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table site_global
# ------------------------------------------------------------

CREATE TABLE `site_global` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `label` varchar(20) NOT NULL,
  `json` tinyint(4) NOT NULL DEFAULT '0',
  `data` text,
  PRIMARY KEY (`id`),
  KEY `fk_site_global_site1_idx` (`site_id`),
  KEY `idx_label` (`label`),
  CONSTRAINT `fk_site_global_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table site_user
# ------------------------------------------------------------

CREATE TABLE `site_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT '0',
  `deleted` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `fk_site_user_site1_idx` (`site_id`),
  KEY `fk_site_user_user1_idx` (`user_id`),
  KEY `idx_active` (`active`),
  KEY `idx_deleted` (`deleted`),
  CONSTRAINT `fk_site_user_site1` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_site_user_user1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table url
# ------------------------------------------------------------

CREATE TABLE `url` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `site_id` int(11) NOT NULL,
  `url` varchar(255) NOT NULL,
  `admin` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Does this URL gain access to the admin tools?',
  `type` enum('local','development','production') DEFAULT NULL COMMENT 'Type of host.',
  PRIMARY KEY (`id`),
  KEY `fk_url_site_idx` (`site_id`),
  KEY `idx_url` (`url`),
  CONSTRAINT `fk_url_site` FOREIGN KEY (`site_id`) REFERENCES `site` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table user
# ------------------------------------------------------------

CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) DEFAULT NULL,
  `email_address` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_email_address` (`email_address`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;




/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
