USE `default`;
--
-- Host: 127.0.0.1    Database: theke_v2
-- ------------------------------------------------------


--
-- 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`
--

/*!40000 ALTER TABLE `backend_permissions`
  DISABLE KEYS */;
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);
/*!40000 ALTER TABLE `backend_permissions`
  ENABLE KEYS */;

--
-- 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`
--

/*!40000 ALTER TABLE `backend_permissions_groups`
  DISABLE KEYS */;
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);
/*!40000 ALTER TABLE `backend_permissions_groups`
  ENABLE KEYS */;

--
-- 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`
--

/*!40000 ALTER TABLE `backend_user_types`
  DISABLE KEYS */;
INSERT INTO `backend_user_types` VALUES (1, 'Staff', '2015-05-19 10:01:45', '0000-00-00 00:00:00');
/*!40000 ALTER TABLE `backend_user_types`
  ENABLE KEYS */;

--
-- 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`
--

/*!40000 ALTER TABLE `backend_users_permissions`
  DISABLE KEYS */;
INSERT INTO `backend_users_permissions` VALUES (1, 1), (2, 1), (1, 2), (2, 2), (1, 3), (2, 3);
/*!40000 ALTER TABLE `backend_users_permissions`
  ENABLE KEYS */;

--
-- 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 = 15
  DEFAULT CHARSET = utf8;

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

/*!40000 ALTER TABLE `entries`
  DISABLE KEYS */;
INSERT INTO `entries` VALUES (8, NULL, 1, NULL, NULL, NULL, '2015-10-09 10:29:12', '2015-10-09 10:29:12');
/*!40000 ALTER TABLE `entries`
  ENABLE KEYS */;

--
-- 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 = 19
  DEFAULT CHARSET = utf8;

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

/*!40000 ALTER TABLE `entries_lang`
  DISABLE KEYS */;
INSERT INTO `entries_lang` VALUES (8, 8, 'en', 'Homepage', '');
/*!40000 ALTER TABLE `entries_lang`
  ENABLE KEYS */;

--
-- 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`
--

/*!40000 ALTER TABLE `failed_jobs`
  DISABLE KEYS */;
/*!40000 ALTER TABLE `failed_jobs`
  ENABLE KEYS */;

--
-- 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`
--

/*!40000 ALTER TABLE `media_items`
  DISABLE KEYS */;
/*!40000 ALTER TABLE `media_items`
  ENABLE KEYS */;

--
-- 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_old`    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
  AUTO_INCREMENT = 4
  DEFAULT CHARSET = utf8;

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

/*!40000 ALTER TABLE `menu_items`
  DISABLE KEYS */;
/*!40000 ALTER TABLE `menu_items`
  ENABLE KEYS */;

--
-- 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,
  `url`            VARCHAR(255)              DEFAULT 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
  AUTO_INCREMENT = 6
  DEFAULT CHARSET = utf8;

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

/*!40000 ALTER TABLE `menu_items_lang`
  DISABLE KEYS */;
/*!40000 ALTER TABLE `menu_items_lang`
  ENABLE KEYS */;

--
-- 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`
--

/*!40000 ALTER TABLE `menus`
  DISABLE KEYS */;
INSERT INTO `menus` VALUES (1, 'Main Menu', 'main-menu', '2015-10-08 17:13:23', NULL);
/*!40000 ALTER TABLE `menus`
  ENABLE KEYS */;

--
-- 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`
--

/*!40000 ALTER TABLE `migrations`
  DISABLE KEYS */;
INSERT INTO `migrations`
VALUES ('2014_05_28_110022_create_failed_jobs_table', 1), ('2014_05_29_094604_create_password_reminders_table', 1);
/*!40000 ALTER TABLE `migrations`
  ENABLE KEYS */;

--
-- 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 = 699794
  DEFAULT CHARSET = utf8;

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

/*!40000 ALTER TABLE `website_objects`
  DISABLE KEYS */;
INSERT INTO `website_objects` VALUES
  (8, 8, 'Entry', NULL, 'page', 'home', '/', 'homepage', 'published', 1, '2015-10-09 10:29:12', '2017-02-23 16:53:31');
/*!40000 ALTER TABLE `website_objects`
  ENABLE KEYS */;

--
-- Table structure for table `website_objects_lang`
--

CREATE TABLE `website_objects_lang` (
  `wo_translation_id` INT(10) UNSIGNED        NOT NULL AUTO_INCREMENT,
  `website_object_id` INT(10) UNSIGNED        NOT NULL,
  `wo_language_id`    VARCHAR(10)
                      COLLATE utf8_unicode_ci NOT NULL,
  `lang_slug`         VARCHAR(150)
                      COLLATE utf8_unicode_ci NOT NULL,
  `lang_uri`          VARCHAR(255)
                      COLLATE utf8_unicode_ci          DEFAULT NULL,
  PRIMARY KEY (`wo_translation_id`),
  UNIQUE KEY `Index_2` (`website_object_id`, `wo_language_id`),
  UNIQUE KEY `Index_3` (`wo_language_id`, `lang_slug`) USING BTREE,
  KEY `FK_website_objects_lang_2` (`wo_language_id`),
  CONSTRAINT `FK_website_objects_lang_1` FOREIGN KEY (`website_object_id`) REFERENCES `website_objects` (`website_object_id`)
    ON DELETE CASCADE
)
  ENGINE = InnoDB
  AUTO_INCREMENT = 9
  DEFAULT CHARSET = utf8
  COLLATE = utf8_unicode_ci;

--
-- Dumping data for table `website_objects_lang`
--

/*!40000 ALTER TABLE `website_objects_lang`
  DISABLE KEYS */;
INSERT INTO `website_objects_lang` VALUES (1, 8, 'en', 'home', '/');
/*!40000 ALTER TABLE `website_objects_lang`
  ENABLE KEYS */;

--
-- 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 = 21
  DEFAULT CHARSET = utf8;

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

/*!40000 ALTER TABLE `website_objects_search`
  DISABLE KEYS */;
INSERT INTO `website_objects_search`
VALUES (8, 'en', ' Homepage', '', NULL, 'Homepage', NULL, 'page', 'Pages', '/', 17);
/*!40000 ALTER TABLE `website_objects_search`
  ENABLE KEYS */;


