CREATE TABLE IF NOT EXISTS `subscribe_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `module` varchar(250) NOT NULL,
  `keyword` varchar(250) NOT NULL,
  `status` enum('Active','Inactive') NOT NULL DEFAULT 'Inactive',
  PRIMARY KEY (`id`),
  KEY `module` (`module`),
  KEY `status` (`status`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `subscribe_categories_i18n` (
  `id` int(11) NOT NULL,
  `label` varchar(150) NOT NULL,
  `locale` varchar(5) NOT NULL DEFAULT 'en_US',
  KEY `id` (`id`),
  KEY `label` (`label`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `subscribe_subscribes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userId` int(11) NOT NULL,
  `categoryId` int(11) NOT NULL,
  `entityId` int(11) DEFAULT NULL,
  `frequency` enum('none','instantly', 'daily', 'monthly','weekly') NOT NULL DEFAULT 'none',
  PRIMARY KEY (`id`),
  KEY `frequency` (`frequency`),
  KEY `categoryId` (`categoryId`),
  KEY `entityId` (`entityId`),
  KEY `userId` (`userId`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

INSERT INTO `page_pages` (`parentId`, `keyword`, `status`, `type`, `route`, `template`, `created`, `updated`) VALUES 
(0, 'subscribe', 'Enabled', 'Module', 'subscribe', 'default', NOW(), NOW());

INSERT INTO `page_pages_i18n` (`id`, `label`, `content`, `header`, `metaTitle`, `metaDescr`, `metaKeywords`, `locale`) VALUES 
(LAST_INSERT_ID(), 'Subscription services', 'Subscription services', 'Subscription services', 'Subscription services', 'Subscription services', 'Subscription services', 'en_US');
