CREATE TABLE IF NOT EXISTS `resource` (
  `id_resource` int(11) NOT NULL AUTO_INCREMENT,
  `id_item` int(11) NOT NULL,
  `id_resource_type` int(11) NOT NULL,
  `parent_id` int(11) NOT NULL DEFAULT '0',
  `position` tinyint(3) NOT NULL DEFAULT '0',
  `private` tinyint(1) NOT NULL DEFAULT '0',
  `deleted` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_resource`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;
INSERT INTO `resource` (`id_resource`, `id_item`, `id_resource_type`, `parent_id`, `position`, `private`, `deleted`) VALUES
(1, 1, 1, 0, 1, 1, 0),
(2, 2, 1, 0, 0, 0, 0),
(3, 3, 1, 0, 2, 0, 0),
(4, 1, 2, 1, 0, 0, 0),
(5, 1, 3, 2, 1, 0, 0);

CREATE TABLE IF NOT EXISTS `resource_type` (
  `id_resource_type` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) CHARACTER SET utf8 NOT NULL,
  `alias` varchar(32) CHARACTER SET utf8 NOT NULL,
  `icon` varchar(32) CHARACTER SET utf8 NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id_resource_type`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
INSERT INTO `resource_type` (`id_resource_type`, `name`, `alias`, `icon`, `active`) VALUES
(1, 'folder', 'Folder', 'icon-folder-open', 1),
(2, 'page_template', 'Page template', 'icon-list-alt', 1),
(3, 'page', 'Page', 'icon-book', 1),
(4, 'resource', 'Resource', 'icon-file', 1);

CREATE TABLE IF NOT EXISTS `resource_type_folder` (
  `id_resource_type_folder` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`id_resource_type_folder`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
INSERT INTO `resource_type_folder` (`id_resource_type_folder`, `name`) VALUES
(1, 'Templates'),
(2, 'Pages'),
(3, 'Tools');

CREATE TABLE IF NOT EXISTS `resource_type_page` (
  `id_resource_type_page` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  `id_resource_type_page_template` int(11) NOT NULL,
  `alias` varchar(256) NOT NULL,
  `route` varchar(256) NOT NULL DEFAULT '.*',
  `cache` tinyint(1) NOT NULL DEFAULT '0',
  `active` tinyint(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id_resource_type_page`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
INSERT INTO `resource_type_page` (`id_resource_type_page`, `name`, `id_resource_type_page_template`, `alias`, `route`, `cache`, `active`) VALUES
(1, 'Home', 1, 'home', '.*', 0, 1);

CREATE TABLE IF NOT EXISTS `resource_type_page_data` (
  `id_resource_type_page_data` int(11) NOT NULL AUTO_INCREMENT,
  `id_resource_type_page` int(11) NOT NULL,
  `id_lan` int(11) NOT NULL,
  `seo_title` varchar(256) NOT NULL,
  `seo_keywords` varchar(256) NOT NULL,
  `seo_description` text NOT NULL,
  PRIMARY KEY (`id_resource_type_page_data`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=18 ;
INSERT INTO `resource_type_page_data` (`id_resource_type_page_data`, `id_resource_type_page`, `id_lan`, `seo_title`, `seo_keywords`, `seo_description`) VALUES
(5, 1, 1, 'Home page', '', '');

CREATE TABLE IF NOT EXISTS `resource_type_page_template` (
  `id_resource_type_page_template` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  `mime_type` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id_resource_type_page_template`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
INSERT INTO `resource_type_page_template` (`id_resource_type_page_template`, `name`, `mime_type`) VALUES
(1, 'Home', 1);

CREATE TABLE IF NOT EXISTS `resource_type_page_template_translate` (
  `id_resource_type_page_template_translate` int(11) NOT NULL AUTO_INCREMENT,
  `id_resource_type_page_template` int(11) NOT NULL,
  `id_lan` tinyint(1) NOT NULL,
  `content` mediumtext NOT NULL,
  PRIMARY KEY (`id_resource_type_page_template_translate`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
INSERT INTO `resource_type_page_template_translate` (`id_resource_type_page_template_translate`, `id_resource_type_page_template`, `id_lan`, `content`) VALUES
(2, 1, 1, '<html>\r\n <head>\r\n </head>\r\n <body>\r\n  Home page\r\n </body>\r\n</html>');

CREATE TABLE IF NOT EXISTS `resource_type_resource` (
  `id_resource_type_resource` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  `alias` varchar(32) NOT NULL,
  `editor` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_resource_type_resource`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;

CREATE TABLE IF NOT EXISTS `resource_type_resource_translate` (
  `id_resource_type_resource_translate` int(11) NOT NULL AUTO_INCREMENT,
  `id_resource_type_resource` int(11) NOT NULL,
  `id_lan` tinyint(3) NOT NULL,
  `content` mediumtext NOT NULL,
  PRIMARY KEY (`id_resource_type_resource_translate`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=10 ;