CREATE TABLE IF NOT EXISTS `simple_cms_pages` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `page_name` varchar(250) DEFAULT NULL,
  `page_path` text,
  `page_title` varchar(250) DEFAULT NULL,
  `page_orden` int,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `simple_cms_files` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `file_name` varchar(250) DEFAULT NULL,
  `file_original_name` varchar(250) DEFAULT NULL,
  `date_added` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `simple_cms_roles` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `role` varchar(250) DEFAULT NULL,
  `status` enum('T','F') DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `simple_cms_sections` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `section_type` enum('section','banner','setting') DEFAULT 'section',
  `section_name` varchar(250) NOT NULL,
  `section_width` int(10) unsigned NOT NULL,
  `section_width_type` enum('px','%') DEFAULT 'px',
  `section_height` int(10) unsigned NOT NULL,
  `section_height_type` enum('px','%') DEFAULT 'px',
  `small_width` int(10) unsigned DEFAULT NULL,
  `small_height` int(10) unsigned DEFAULT NULL,
  `large_width` int(10) unsigned DEFAULT NULL,
  `large_height` int(10) unsigned DEFAULT NULL,
  `section_character` int(10) DEFAULT NULL,
  `section_content` longtext,
  `animation` varchar(100) DEFAULT NULL,
  `images` int(10) DEFAULT NULL,
  `date_added` datetime DEFAULT NULL,
  `setting_title` varchar(250) DEFAULT NULL,
  `setting_description` text,
  `setting_search` enum('T','F') DEFAULT NULL,
  `setting_keywords` text,
  `setting_icon` varchar(250) DEFAULT NULL,
  `setting_facebook_1` varchar(250) DEFAULT NULL,
  `setting_facebook_2` varchar(250) DEFAULT NULL,
  `setting_facebook_3` varchar(250) DEFAULT NULL,
  `setting_analytics` text,
  `setting_background` longtext,
  `setting_video_fill` varchar(250) DEFAULT NULL,
  `setting_color_fill` varchar(250) DEFAULT NULL,
  `setting_image_fill_0` varchar(250) DEFAULT NULL,
  `setting_image_fill_1` varchar(250) DEFAULT NULL,
  `setting_image_fill_2` varchar(250) DEFAULT NULL,
  `setting_image_fill_3` varchar(250) DEFAULT NULL,
  `setting_image_fill_4` varchar(250) DEFAULT NULL,
  `setting_image_fill_5` varchar(250) DEFAULT NULL,
  `setting_image_fill_6` varchar(250) DEFAULT NULL,
  `setting_image` enum('original','tile','parallax_original','parallax_tile','fade_slider') DEFAULT NULL,  
  `setting_video` enum('true','false') DEFAULT NULL,  
  `plugins_to_edit_content` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `simple_cms_gallery` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `foreign_id` int(10) unsigned DEFAULT NULL,
  `mime_type` varchar(255) DEFAULT NULL,
  `path` varchar(255) DEFAULT NULL,
  `small_path` varchar(255) DEFAULT NULL,
  `large_path` varchar(255) DEFAULT NULL,
  `url` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `status` enum('T','F') NOT NULL DEFAULT 'T',
  `order` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `foreign` (`foreign_id`),
  KEY `status` (`status`)
) DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `simple_cms_users_files` (
  `user_id` int(10) unsigned NOT NULL,
  `file_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`user_id`,`file_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `simple_cms_users_sections` (
  `user_id` int(10) unsigned NOT NULL,
  `section_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`user_id`,`section_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `simple_cms_users_pages` (
  `user_id` int(10) unsigned NOT NULL,
  `page_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`user_id`,`page_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `simple_cms_pages_sections` (
  `page_id` int(10) unsigned NOT NULL,
  `section_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`page_id`,`section_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `simple_cms_roles` (`id`, `role`, `status`) VALUES
(1, 'admin', 'T'),
(2, 'editor', 'T');