CREATE DATABASE  IF NOT EXISTS `base_cms` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;
USE `base_cms`;
--
-- Host: test.eae.pt    Database: base_cms
-- ------------------------------------------------------


--
-- Table structure for table `backend_permissions`
--

CREATE TABLE `backend_permissions` (
  `id` int(10) unsigned NOT NULL,
  `group_id` int(10) unsigned NOT NULL,
  `name` varchar(50) NOT NULL,
  `display_name` varchar(100) NOT NULL,
  `position` smallint(5) unsigned NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_backend_permissions_1` (`group_id`),
  CONSTRAINT `FK_backend_permissions_1` FOREIGN KEY (`group_id`) REFERENCES `backend_permissions_groups` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `backend_permissions`
--

INSERT INTO `backend_permissions` VALUES (1,2,'users.view','View back of house users and permissions ',1,'2014-04-14 18:31:15','2014-04-14 18:31:15'),(2,2,'users.insert','Add back of house users and define their permissions',2,'2014-04-17 10:16:33','2014-04-17 10:16:33'),(3,3,'cms.manage','Content management',1,'2015-05-12 10:52:38',NULL);

--
-- Table structure for table `backend_permissions_groups`
--

CREATE TABLE `backend_permissions_groups` (
  `id` int(10) unsigned NOT NULL,
  `name` varchar(100) NOT NULL,
  `position` int(10) unsigned NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `backend_permissions_groups`
--

INSERT INTO `backend_permissions_groups` VALUES (2,'BO Users and Permissions',7,'2015-05-12 10:45:43',NULL),(3,'CMS',1,'2015-05-12 10:45:43',NULL);

--
-- Table structure for table `backend_user_types`
--

CREATE TABLE `backend_user_types` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `backend_user_types`
--

INSERT INTO `backend_user_types` VALUES (1,'Staff','2015-05-19 10:01:45','0000-00-00 00:00:00');

--
-- Table structure for table `backend_users_permissions`
--

CREATE TABLE `backend_users_permissions` (
  `backend_user_id` int(10) unsigned NOT NULL,
  `backend_permission_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`backend_user_id`,`backend_permission_id`),
  KEY `FK_backend_user_permission_2` (`backend_permission_id`),
  CONSTRAINT `FK_backend_user_permission_1` FOREIGN KEY (`backend_user_id`) REFERENCES `backend_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_backend_user_permission_2` FOREIGN KEY (`backend_permission_id`) REFERENCES `backend_permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `backend_users_permissions`
--

INSERT INTO `backend_users_permissions` VALUES (1,1),(2,1),(1,2),(2,2),(1,3),(2,3);

--
-- Table structure for table `entries`
--

CREATE TABLE `entries` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `parent_id` int(10) unsigned DEFAULT NULL,
  `backend_user_id` int(10) unsigned DEFAULT NULL,
  `picture` varchar(150) DEFAULT NULL,
  `entry_date` datetime DEFAULT NULL,
  `image_id` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_entries_1` (`backend_user_id`),
  KEY `FK_entries_2` (`parent_id`),
  KEY `FK_entries_3` (`image_id`),
  CONSTRAINT `FK_entries_1` FOREIGN KEY (`backend_user_id`) REFERENCES `backend_users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  CONSTRAINT `FK_entries_2` FOREIGN KEY (`parent_id`) REFERENCES `entries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_entries_3` FOREIGN KEY (`image_id`) REFERENCES `media_items` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `entries`
--

INSERT INTO `entries` VALUES (8,NULL,1,NULL,NULL,NULL,'2015-10-09 10:29:12','2015-10-09 10:29:12');

--
-- Table structure for table `entries_lang`
--

CREATE TABLE `entries_lang` (
  `translation_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `entry_id` int(10) unsigned NOT NULL,
  `language_id` varchar(10) NOT NULL,
  `title` varchar(150) DEFAULT NULL,
  `content` mediumtext,
  PRIMARY KEY (`translation_id`) USING BTREE,
  UNIQUE KEY `idx_entry_lang` (`entry_id`,`language_id`),
  CONSTRAINT `FK_entries_lang_1` FOREIGN KEY (`entry_id`) REFERENCES `entries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `entries_lang`
--

INSERT INTO `entries_lang` VALUES (8,8,'pt','Homepage','');

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `connection` text COLLATE utf8_unicode_ci NOT NULL,
  `queue` text COLLATE utf8_unicode_ci NOT NULL,
  `payload` text COLLATE utf8_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `failed_jobs`
--


--
-- Table structure for table `media_items`
--

CREATE TABLE `media_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `filename` varchar(255) NOT NULL,
  `original_filename` varchar(255) NOT NULL,
  `extension` varchar(5) NOT NULL,
  `related_type` varchar(20) DEFAULT NULL,
  `media_type` varchar(20) NOT NULL,
  `backend_user_id` int(10) unsigned NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  `title` varchar(150) DEFAULT NULL,
  `alt` varchar(150) DEFAULT NULL,
  `author` varchar(150) DEFAULT NULL,
  `width` int(10) unsigned DEFAULT NULL,
  `height` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_media_items_1` (`backend_user_id`),
  CONSTRAINT `FK_media_items_1` FOREIGN KEY (`backend_user_id`) REFERENCES `backend_users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2722 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `media_items`
--


--
-- Table structure for table `menu_items`
--

CREATE TABLE `menu_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `parent_id` int(10) unsigned DEFAULT NULL,
  `menu_id` int(10) unsigned NOT NULL,
  `entry_id` int(10) unsigned DEFAULT NULL,
  `url` varchar(255) NOT NULL,
  `target` varchar(20) DEFAULT NULL,
  `position` int(10) unsigned DEFAULT NULL,
  `active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_menu_items_1` (`menu_id`),
  KEY `FK_menu_items_2` (`parent_id`),
  KEY `FK_menu_items_4` (`entry_id`),
  CONSTRAINT `FK_menu_items_1` FOREIGN KEY (`menu_id`) REFERENCES `menus` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_menu_items_2` FOREIGN KEY (`parent_id`) REFERENCES `menu_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_menu_items_4` FOREIGN KEY (`entry_id`) REFERENCES `entries` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `menu_items`
--


--
-- Table structure for table `menu_items_lang`
--

CREATE TABLE `menu_items_lang` (
  `translation_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `menu_item_id` int(10) unsigned NOT NULL,
  `language_id` varchar(10) NOT NULL,
  `title` varchar(100) NOT NULL,
  PRIMARY KEY (`translation_id`) USING BTREE,
  KEY `FK_menu_items_lang_1_1` (`menu_item_id`),
  KEY `FK_menu_items_lang_2_1` (`language_id`),
  CONSTRAINT `FK_menu_items_lang_1_1` FOREIGN KEY (`menu_item_id`) REFERENCES `menu_items` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `menu_items_lang`
--


--
-- Table structure for table `menus`
--

CREATE TABLE `menus` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `slug` varchar(50) NOT NULL,
  `created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_date` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `menus`
--

INSERT INTO `menus` VALUES (1,'Main Menu','main-menu','2015-10-08 17:13:23',NULL);

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` VALUES ('2014_05_28_110022_create_failed_jobs_table',1),('2014_05_29_094604_create_password_reminders_table',1);

--
-- Table structure for table `website_objects`
--

CREATE TABLE `website_objects` (
  `website_object_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `object_id` int(10) unsigned NOT NULL,
  `object_type` varchar(50) NOT NULL,
  `parent_id` int(10) unsigned DEFAULT NULL,
  `content_type` varchar(50) NOT NULL,
  `slug` varchar(150) NOT NULL,
  `uri` varchar(255) DEFAULT NULL,
  `template` varchar(255) DEFAULT NULL,
  `status` varchar(20) NOT NULL,
  `position` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`website_object_id`) USING BTREE,
  UNIQUE KEY `idx_website_objects_slug` (`slug`),
  UNIQUE KEY `idx_website_object` (`object_id`,`object_type`),
  KEY `FK_website_objects_2` (`parent_id`),
  CONSTRAINT `FK_website_objects_2` FOREIGN KEY (`parent_id`) REFERENCES `website_objects` (`website_object_id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=699790 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `website_objects`
--

INSERT INTO `website_objects` VALUES (8,8,'Entry',NULL,'page','home','/','homepage','published',2,'2015-10-09 10:29:12','2015-11-06 16:55:37');

--
-- Table structure for table `website_objects_search`
--

CREATE TABLE `website_objects_search` (
  `website_object_id` int(10) unsigned NOT NULL,
  `language_id` varchar(10) NOT NULL,
  `primary_search` longtext NOT NULL,
  `secondary_search` longtext NOT NULL,
  `image_id` int(10) unsigned DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `content` text,
  `content_type` varchar(100) NOT NULL,
  `group_label` varchar(100) NOT NULL,
  `uri` varchar(255) DEFAULT NULL,
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`),
  UNIQUE KEY `Index_7` (`website_object_id`,`language_id`),
  KEY `idx_website_objects_search_language` (`language_id`),
  FULLTEXT KEY `idx_website_objects_search_ft` (`primary_search`,`secondary_search`),
  FULLTEXT KEY `Index_4` (`primary_search`),
  FULLTEXT KEY `Index_5` (`secondary_search`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `website_objects_search`
--

INSERT INTO `website_objects_search` VALUES (8,'pt',' Homepage','',NULL,'Homepage',NULL,'page','Pages','/',2);

--
-- Dumping events for database 'base_cms'
--

--
-- Dumping routines for database 'base_cms'
--


