INSERT INTO `ei_DPageItemType` (`id`, `type`, `title`, `sorter`)
VALUES (NULL, 'Blog\\', 'Blog', 130) ;


CREATE TABLE IF NOT EXISTS `ei_Post` (
`id` int(11) NOT NULL,
  `date` datetime NOT NULL,
  `title` varchar(255) NOT NULL,
  `alias` varchar(255) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `content` mediumtext NOT NULL,
  `rawContent` mediumtext NOT NULL,
  `excerpt` text NOT NULL,
  `authorType` enum('admin','user') DEFAULT NULL,
  `authorId` int(11) DEFAULT NULL,
  `author` varchar(255) DEFAULT NULL,
  `categoryId` int(11) NOT NULL DEFAULT '0',
  `featured` enum('y','n') NOT NULL DEFAULT 'n',
  `password` varchar(255) DEFAULT NULL,
  `allowComment` enum('y','n') NOT NULL DEFAULT 'y',
  `metaKeywords` text,
  `metaDescription` text,
  `enabled` enum('y','n') NOT NULL,
  `added` datetime NOT NULL,
  `changed` datetime NOT NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `ei_Post2Tag` (
`id` int(11) NOT NULL,
  `idPost` int(11) NOT NULL,
  `idTag` int(11) NOT NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `ei_PostCategory` (
`id` int(11) NOT NULL,
  `alias` varchar(255) DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `sorter` int(11) NOT NULL DEFAULT '0',
  `enabled` enum('y','n') NOT NULL,
  `added` datetime NOT NULL,
  `changed` datetime NOT NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


CREATE TABLE IF NOT EXISTS `ei_PostComment` (
`id` int(11) NOT NULL,
  `idPost` int(11) NOT NULL,
  `date` datetime NOT NULL,
  `author` varchar(255) DEFAULT NULL,
  `authorId` int(11) DEFAULT NULL,
  `authorType` enum('admin','user') DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `content` text NOT NULL,
  `ipAddress` varchar(20) DEFAULT NULL,
  `userAgent` varchar(255) DEFAULT NULL,
  `referer` varchar(255) DEFAULT NULL,
  `status` enum('pending','approved','disapproved','spam') NOT NULL DEFAULT 'pending',
  `added` datetime NOT NULL,
  `changed` datetime NOT NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `ei_PostTag` (
`id` int(11) NOT NULL,
  `value` varchar(255) NOT NULL
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


ALTER TABLE `ei_Post`
 ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `alias` (`alias`), ADD KEY `date` (`date`);

ALTER TABLE `ei_Post2Tag`
 ADD PRIMARY KEY (`id`), ADD KEY `idPost` (`idPost`,`idTag`);

ALTER TABLE `ei_PostCategory`
 ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `alias` (`alias`);

ALTER TABLE `ei_PostComment`
 ADD PRIMARY KEY (`id`);

ALTER TABLE `ei_PostTag`
 ADD PRIMARY KEY (`id`);

ALTER TABLE `ei_Post`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;

ALTER TABLE `ei_Post2Tag`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;

ALTER TABLE `ei_PostCategory`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;

ALTER TABLE `ei_PostComment`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;

ALTER TABLE `ei_PostTag`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;


INSERT INTO `ei_Settings` (`name`, `idCategory`, `fieldType`, `label`, `value`, `options`, `description`, `required`, `system`, `sorter`, `added`, `changed`) VALUES
('blogCommentEmailBody', 2, 'HtmlEditor', 'Message Body', '<p>New comment on the blog post has been submitted on Elements, Inc website.<br />\r\n<br />\r\nPost Title: <strong>{postTitle}</strong><br />\r\nAuthor Name: <strong>{author}</strong><br />\r\nAuthor Email: <strong>{email}</strong><br />\r\nComment:&nbsp;<strong>{comment}</strong><br />\r\n<br />\r\nClick <a href="{link}">here</a> to view details.</p>\r\n', '', 'Constants: {postTitle} {author} {email} {comment} {link}', 'y', 'n', 240, '2017-04-14 10:00:00', '2017-04-14 10:00:00'),
('blogCommentEmailFrom', 2, 'text', 'From Email Address &nbsp; <span class="label_description">If you leave this field empty - the From Email Address will be the same as the one in General Settings.</span>', '', '', '', 'n', 'n', 220, '2017-04-14 10:00:00', '2017-04-14 10:00:00'),
('blogCommentEmailHeader', 2, 'header', '', 'Blog Comment Submission (Admin Notification)', '', '', 'n', 'n', 200, '2017-04-14 10:00:00', '2017-04-14 10:00:00'),
('blogCommentEmailSubject', 2, 'text', 'Subject', 'New blog comment has been received', '', '', 'y', 'n', 210, '2017-04-14 10:00:00', '2017-04-14 10:00:00'),
('blogCommentEmailTo', 2, 'emails', 'To Email Address(es) &nbsp; <span class="label_description">Enter email address(es) that should receive a notification email regarding Blog comments submissions on your website</span>', '', '', 'Use commas to separate email addresses', 'n', 'n', 230, '2017-04-14 10:00:00', '2017-04-14 10:00:00');

INSERT INTO `ei_SettingsOptions` (`id`, `name`, `variable`, `value`, `type`, `sorter`) VALUES
(108, 'blogCommentEmailBody', 'height', '200', 'int', NULL),
(109, 'blogCommentEmailBody', 'mode', 'view', 'string', NULL),
(110, 'blogCommentEmailBody', 'scriptOptions[enterMode]', '2', 'string', NULL),
(111, 'blogCommentEmailBody', 'toolbar', 'Basic', 'string', NULL);
