-- ---------------------------------------------------------------------------------------------------------------------
-- about-us/blog page
-- ---------------------------------------------------------------------------------------------------------------------
/*SET AUTOCOMMIT=0;
START TRANSACTION;


-- Page: "about-us/blog" (id = 636, idParent = 565) ------------------------------------------------

INSERT INTO `pl_Page` (`alias`, `handler`, `bodyTemplate`, `showInSiteMap`, `showInMenu`, `showInFooter`, `enabled`, `allowDelete`, `isSecure`, `isIndexing`, `showInDropdowns`, `showSideBlock`, `isRoot`, `hasBlocks`, `final`, `system`, `redirect`, `redirectType`, `redirectPageId`, `redirectStatus`, `redirectAlias`, `customOptions`, `headerImage`, `sorter`, `added`, `changed`, `idParent`)
VALUES ('blog', 'site', 'default.tpl', 'y', 'y', 'y', 'y', 'n', 'y', 'y', 'y', 'y', 'n', 'y', 'y', 'n', 'n', '', '0', '302', '', '', '', 218929015, '2018-07-03 10:41:50', '2018-07-03 11:27:49', 565);
SET @pageId636 := LAST_INSERT_ID();
INSERT INTO `pl_PageContent` (`title`, `menuTitle`, `header`, `language`, `idPage`) VALUES ('', 'Blog', '', 'eng', @pageId636);
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'showInSiteMap', 'y', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'showInMenu', 'y', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'showInFooter', 'y', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'enabled', 'y', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'allowDelete', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'isSecure', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'isIndexing', 'y', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'final', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'system', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'redirect', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'allowSubpages', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'isAdditional', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'showInCtrlMenu', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'requireSu', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'isAccountNavigation', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'showInDropdowns', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId636, 'showSideBlock', 'n', 'y');
INSERT INTO `pl_HtmlBlock` (`added`) VALUES ('2018-07-03 11:27:49');
SET @htmlBlockId2882 := LAST_INSERT_ID();
INSERT INTO `pl_HtmlBlockContent` (`idBlock`, `language`, `content`, `rawContent`, `added`, `changed`) VALUES (@htmlBlockId2882, 'eng', '', '', '2018-07-03 11:27:49', '2018-07-03 11:27:49');
INSERT INTO `pl_PageItem` (`idGroup`, `type`, `number`, `allowDelete`, `sorter`, `added`, `changed`, `idPage`) VALUES ('1', 'HtmlBlock_', @htmlBlockId2882, 'y', '1', '2018-07-03 11:27:49', '2018-07-03 11:27:49', @pageId636);
INSERT INTO `pl_PageItem` (`idGroup`, `type`, `allowDelete`, `sorter`, `added`, `changed`, `idPage`) VALUES ('1', 'Blog\\', 'y', '2', '2018-07-03 11:27:49', '2018-07-03 11:27:49', @pageId636);
SET @pageItemId4308 := LAST_INSERT_ID();
INSERT INTO `pl_PageItemConfig` (`idItem`, `name`, `value`) VALUES (@pageItemId4308, 'blocks[0]', 'category');
INSERT INTO `pl_PageItemConfig` (`idItem`, `name`, `value`) VALUES (@pageItemId4308, 'blocks[1]', 'tag');
INSERT INTO `pl_PageItemConfig` (`idItem`, `name`, `value`) VALUES (@pageItemId4308, 'blocks[2]', 'month');
INSERT INTO `pl_PageItemConfig` (`idItem`, `name`, `value`) VALUES (@pageItemId4308, 'blocks[3]', 'calendar');

COMMIT;
*/

-- ---------------------------------------------------------------------------------------------------------------------
-- account/blog page
-- ---------------------------------------------------------------------------------------------------------------------
SET AUTOCOMMIT=0;
START TRANSACTION;


-- Page: "account/blog" (id = 638, idParent = 608) ------------------------------------------------

INSERT INTO `pl_Page` (`alias`, `handler`, `bodyTemplate`, `showInSiteMap`, `showInMenu`, `showInFooter`, `enabled`, `allowDelete`, `isSecure`, `isIndexing`, `showInDropdowns`, `showSideBlock`, `isRoot`, `hasBlocks`, `final`, `system`, `redirect`, `redirectType`, `redirectPageId`, `redirectStatus`, `redirectAlias`, `customOptions`, `headerImage`, `sorter`, `added`, `changed`, `idParent`)
VALUES ('blog', 'user', 'default.tpl', 'n', 'n', 'n', 'y', 'n', 'y', 'n', 'y', 'n', 'n', 'y', 'y', 'n', 'n', '', '0', '302', '', '', '', 176311308, '2018-07-03 12:04:28', '2018-07-03 12:34:26', 608);
SET @pageId638 := LAST_INSERT_ID();
INSERT INTO `pl_PageContent` (`title`, `menuTitle`, `header`, `language`, `idPage`) VALUES ('', 'Blog', '', 'eng', @pageId638);
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'showInSiteMap', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'showInMenu', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'showInFooter', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'enabled', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'allowDelete', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'isSecure', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'isIndexing', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'final', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'system', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'redirect', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'allowSubpages', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'isAdditional', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'showInCtrlMenu', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'requireSu', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'isAccountNavigation', 'y', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'showInDropdowns', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId638, 'showSideBlock', 'n', 'n');
INSERT INTO `pl_HtmlBlock` (`added`) VALUES ('2018-07-03 12:34:26');
SET @htmlBlockId2889 := LAST_INSERT_ID();
INSERT INTO `pl_HtmlBlockContent` (`idBlock`, `language`, `content`, `rawContent`, `added`, `changed`) VALUES (@htmlBlockId2889, 'eng', '', '', '2018-07-03 12:34:26', '2018-07-03 12:34:26');
INSERT INTO `pl_PageItem` (`idGroup`, `type`, `number`, `allowDelete`, `sorter`, `added`, `changed`, `idPage`) VALUES ('1', 'HtmlBlock_', @htmlBlockId2889, 'y', '1', '2018-07-03 12:34:26', '2018-07-03 12:34:26', @pageId638);
INSERT INTO `pl_PageItem` (`idGroup`, `type`, `allowDelete`, `sorter`, `added`, `changed`, `idPage`) VALUES ('1', 'Blog\\Admin\\', 'n', '2', '2018-07-03 12:34:26', '2018-07-03 12:34:26', @pageId638);

-- Page: "account/blog/comments" (id = 639, idParent = 638) ------------------------------------------------

INSERT INTO `pl_Page` (`alias`, `handler`, `bodyTemplate`, `showInSiteMap`, `showInMenu`, `showInFooter`, `enabled`, `allowDelete`, `isSecure`, `isIndexing`, `showInDropdowns`, `showSideBlock`, `isRoot`, `hasBlocks`, `final`, `system`, `redirect`, `redirectType`, `redirectPageId`, `redirectStatus`, `redirectAlias`, `customOptions`, `headerImage`, `sorter`, `added`, `changed`, `idParent`) VALUES ('comments', 'user', 'default.tpl', 'n', 'n', 'n', 'y', 'n', 'y', 'n', 'n', 'n', 'n', 'y', 'y', 'n', 'n', '', '0', '302', '', '', '', 176311306, '2018-07-03 12:27:34', '2018-07-03 12:38:39', @pageId638);
SET @pageId639 := LAST_INSERT_ID();
INSERT INTO `pl_PageContent` (`title`, `menuTitle`, `header`, `language`, `idPage`) VALUES ('', 'Post Comments', '', 'eng', @pageId639);
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'showInSiteMap', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'showInMenu', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'showInFooter', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'enabled', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'allowDelete', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'isSecure', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'isIndexing', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'final', 'n', 'y');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'system', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'redirect', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'allowSubpages', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'isAdditional', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'showInCtrlMenu', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'requireSu', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'isAccountNavigation', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'showInDropdowns', 'n', 'n');
INSERT INTO `pl_PageOption` (`idPage`, `name`, `show`, `value`) VALUES (@pageId639, 'showSideBlock', 'n', 'n');
INSERT INTO `pl_HtmlBlock` (`added`) VALUES ('2018-07-03 12:38:39');
SET @htmlBlockId2890 := LAST_INSERT_ID();
INSERT INTO `pl_HtmlBlockContent` (`idBlock`, `language`, `content`, `rawContent`, `added`, `changed`) VALUES (@htmlBlockId2890, 'eng', '', '', '2018-07-03 12:38:39', '2018-07-03 12:38:39');
INSERT INTO `pl_PageItem` (`idGroup`, `type`, `number`, `allowDelete`, `sorter`, `added`, `changed`, `idPage`) VALUES ('1', 'HtmlBlock_', @htmlBlockId2890, 'y', '1', '2018-07-03 12:38:39', '2018-07-03 12:38:39', @pageId639);
INSERT INTO `pl_PageItem` (`idGroup`, `type`, `allowDelete`, `sorter`, `added`, `changed`, `idPage`) VALUES ('1', 'Blog\\Comment\\Admin\\', 'n', '2', '2018-07-03 12:38:39', '2018-07-03 12:38:39', @pageId639);

COMMIT;

-- ---------------------------------------------------------------------------------------------------------------------
-- Module patches
-- ---------------------------------------------------------------------------------------------------------------------
ALTER TABLE `pl_Post` ADD `createdBy` ENUM('admin','user') NOT NULL DEFAULT 'admin' AFTER `id`;
ALTER TABLE `pl_Post` DROP FOREIGN KEY `pl_Post_ibfk_2`;
ALTER TABLE `pl_Post` CHANGE `createdById` `createdById` INT(11) UNSIGNED NOT NULL;
ALTER TABLE  `pl_Post`
  DROP INDEX  `createdById`,
  ADD INDEX  `createdBy` (  `createdBy` ,  `createdById` );

INSERT INTO `pl_DPageItemType` (`id`, `type`, `title`, `sorter`) VALUES (NULL, 'Blog\\Admin\\', 'Blog Management', '0');
INSERT INTO `pl_DPageItemType` (`id`, `type`, `title`, `sorter`) VALUES (NULL, 'Blog\\Comment\\Admin\\', 'Blog Comments Management', '0');
