CREATE TABLE IF NOT EXISTS `{{prefix}}_navigation` (
  `navigation_id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
  `alias` VARCHAR(20) NOT NULL DEFAULT '',
  `title` VARCHAR(255) NOT NULL DEFAULT '',
  `level1` TEXT NOT NULL,
  `level2` TEXT NOT NULL,
  `level3` TEXT NOT NULL,
  `level1_active` TEXT NOT NULL,
  `level2_active` TEXT NOT NULL,
  `level3_active` TEXT NOT NULL,
  `level1_begin` TEXT NOT NULL,
  `level1_end` TEXT NOT NULL,
  `level2_begin` TEXT NOT NULL,
  `level2_end` TEXT NOT NULL,
  `level3_begin` TEXT NOT NULL,
  `level3_end` TEXT NOT NULL,
  `begin` TEXT NOT NULL,
  `end` TEXT NOT NULL,
  `user_group` TEXT NOT NULL,
  `expand_ext` ENUM('0','1','2') DEFAULT '1',
  PRIMARY KEY (`navigation_id`),
  KEY `idx_alias` (`alias`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `{{prefix}}_navigation_items` (
  `navigation_item_id` MEDIUMINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
  `navigation_id` SMALLINT(3) UNSIGNED NOT NULL DEFAULT 0,
  `document_id` INT(11) DEFAULT NULL,
  `alias` CHAR(255) NOT NULL DEFAULT '',
  `title` CHAR(255) NOT NULL DEFAULT '',
  `description` TEXT NOT NULL,
  `target` ENUM('_blank','_self','_parent','_top') NOT NULL DEFAULT '_self',
  `image` VARCHAR(255) NOT NULL DEFAULT '',
  `css_style` VARCHAR(255) DEFAULT NULL,
  `css_id` VARCHAR(50) DEFAULT NULL,
  `css_class` VARCHAR(50) DEFAULT NULL,
  `parent_id` MEDIUMINT(5) UNSIGNED NOT NULL DEFAULT 0,
  `level` ENUM('1','2','3') NOT NULL DEFAULT '1',
  `position` SMALLINT(3) UNSIGNED NOT NULL DEFAULT 1,
  `status` ENUM('1','0') NOT NULL DEFAULT '1',
  PRIMARY KEY (`navigation_item_id`),
  KEY `idx_navigation_parent` (`navigation_id`, `parent_id`),
  KEY `idx_navigation_position` (`navigation_id`, `position`),
  KEY `idx_document` (`document_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
