INSERT INTO `hd_config` (`config_key`, `value`) VALUES ('default_editor', 'summernote');
INSERT INTO `hd_categories` (`id`, `cat_name`, `parent`, `module`, `pricing_table`) VALUES (7, 'Knowledgebase', '0', 'pages', '');
INSERT INTO `hd_categories` (`id`, `cat_name`, `parent`, `module`, `pricing_table`) VALUES (6, 'FAQ', '0', 'pages', '');
ALTER TABLE `hd_posts` ADD `meta_title` VARCHAR(255) NULL AFTER `option`;
ALTER TABLE `hd_posts` ADD `meta_desc` VARCHAR(255) NULL AFTER `meta_title`;
ALTER TABLE `hd_posts` ADD `knowledge` INT NOT NULL DEFAULT '0' AFTER `meta_desc`;
ALTER TABLE `hd_posts` ADD `faq` INT NOT NULL DEFAULT '0' AFTER `knowledge`;
ALTER TABLE `hd_posts` ADD `knowledge_id` INT NOT NULL AFTER `faq`, ADD `faq_id` INT NOT NULL AFTER `knowledge_id`;
ALTER TABLE `hd_posts` ADD `views` INT NOT NULL AFTER `faq_id`;
ALTER TABLE `hd_posts` ADD `video` VARCHAR(255) NOT NULL AFTER `views`;
ALTER TABLE `hd_items_saved` ADD `create_account` ENUM('Yes','No') NOT NULL DEFAULT 'No' AFTER `default_registrar`;
UPDATE `hd_items_saved` SET `create_account` = 'Yes' WHERE `hd_items_saved`.`create_account` = 'No';
ALTER TABLE `hd_items_saved` ADD `package_config` TEXT NOT NULL AFTER `active`;
ALTER TABLE `hd_items_saved` ADD `addon` INT NOT NULL DEFAULT '0' AFTER `package_config`;
ALTER TABLE `hd_item_pricing` ADD `biennially` DECIMAL(10,2) NOT NULL DEFAULT '0.00' AFTER `annually`, ADD `triennially` DECIMAL(10,2) NOT NULL DEFAULT '0.00' AFTER `biennially`;
ALTER TABLE `hd_item_pricing` ADD `biennially_payments` DECIMAL(10,2) NOT NULL DEFAULT '0.00' AFTER `annually_payments`, ADD `triennially_payments` DECIMAL(10,2) NOT NULL DEFAULT '0.00' AFTER `biennially_payments`;
ALTER TABLE `hd_items_saved` ADD `max_years` INT NOT NULL DEFAULT '1' AFTER `max_payments`;
ALTER TABLE `hd_orders` ADD `years` INT NOT NULL DEFAULT '1' AFTER `registrar`;
ALTER TABLE `hd_orders` ADD `promo` INT NOT NULL DEFAULT '0' AFTER `years`;
ALTER TABLE `hd_orders` ADD `parent` INT NOT NULL DEFAULT '0' AFTER `promo`;
INSERT INTO `hd_categories` (`id`, `cat_name`, `parent`, `module`, `pricing_table`) VALUES ('5', 'Addons', '0', 'items', '');
ALTER TABLE `hd_items_saved` ADD `apply_to` TEXT NULL DEFAULT NULL AFTER `addon`;
ALTER TABLE `hd_invoices` DROP `allow_paypal`, DROP `allow_coinpayments`, DROP `allow_stripe`, DROP `allow_2checkout`, DROP `allow_bitcoin`, DROP `allow_payfast`, DROP `allow_mollie`, DROP `allow_instamojo`, DROP `allow_razorpay`, DROP `allow_paystack`;
ALTER TABLE `hd_companies` ADD `params` TEXT NULL AFTER `notes`;
ALTER TABLE `hd_plugins` ADD `author_uri` VARCHAR(255) NOT NULL AFTER `author`;
ALTER TABLE `hd_plugins` ADD `config` TEXT NULL AFTER `author_uri`;
INSERT INTO `hd_status` (`id`, `status`) VALUES (NULL, 'expired');
ALTER TABLE `hd_companies` ADD `imported` INT NOT NULL DEFAULT '0' AFTER `params`;
ALTER TABLE `hd_servers` ADD `ns1` VARCHAR(100) NULL AFTER `selected`, ADD `ns2` VARCHAR(100) NULL AFTER `ns1`, ADD `ns3` VARCHAR(100) NULL AFTER `ns2`, ADD `ns4` VARCHAR(100) NULL AFTER `ns3`, ADD `ns5` VARCHAR(100) NULL AFTER `ns4`;
UPDATE `hd_blocks` SET `id` = 'domain_pricing_table' WHERE `id` = 'domains_domain_pricing_table_block'; 
UPDATE `hd_blocks` SET `id` = 'domain_availability_checker' WHERE `id` = 'domains_domain_availability_checker_block' ;
UPDATE `hd_blocks` SET `id` = 'cart_icon_block' WHERE `id` = 'cart_cart_icon_block';

CREATE TABLE `hd_promotions` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `type` int(11) NOT NULL,
 `code` varchar(100) NOT NULL,
 `value` decimal(10,2) NOT NULL DEFAULT '0.00',
 `description` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
 `apply_to` text,
 `required` text,
 `billing_cycle` text,
 `start_date` date NOT NULL,
 `end_date` date NOT NULL,
 `payment` int(11) NOT NULL,
 `per_order` int(11) NOT NULL,
 `per_client` int(11) NOT NULL,
 `first_order` int(11) NOT NULL,
 `new_customers` int(11) NOT NULL,
 `use_date` int(11) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;


DROP TABLE hd_plugins;


CREATE TABLE `hd_plugins` (
  `plugin_id` int(11) NOT NULL,
  `system_name` varchar(150) NOT NULL,
  `name` varchar(150) NOT NULL,
  `category` varchar(100) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `uri` varchar(255) DEFAULT NULL,
  `version` varchar(10) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `author` varchar(50) DEFAULT NULL,
  `author_uri` varchar(255) DEFAULT NULL,
  `config` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 

INSERT INTO `hd_plugins` (`plugin_id`, `system_name`, `name`, `category`, `status`, `uri`, `version`, `description`, `author`, `author_uri`, `config`) VALUES
(5, 'cpanel', 'cPanel', 'Servers', 1, 'http://www.hostingbilling.net', '1.0', 'cPanel API Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(6, 'directadmin', 'Directadmin', 'Servers', 1, 'http://www.hostingbilling.net', '1.0', 'Directadmin API Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(7, 'plesk', 'Plesk', 'Servers', 1, 'http://www.hostingbilling.net', '1.0', 'Plesk API Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(8, 'ispconfig', 'ISPConfig', 'Servers', 1, 'http://www.hostingbilling.net', '1.0', 'ISPConfig API Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(9, 'cwp', 'CWP', 'Servers', 1, 'http://www.hostingbilling.net', '1.0', 'Centos Web Panel API Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(10, 'cyberpanel', 'Cyberpanel', 'Servers', 1, 'http://www.hostingbilling.net', '1.0', 'Cyberpanel API Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(11, 'interworx', 'Interworx', 'Servers', 1, 'http://www.hostingbilling.net', '1.0', 'Interworx API Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(12, 'bitcoin', 'Bitcoin', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Bitcoin Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(13, 'checkout', 'Checkout', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', '2Checkout Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(14, 'coinpayments', 'Coinpayments', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Coinpayments Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(15, 'domainscoza', 'Domainscoza', 'Domain Registrars', 1, 'http://www.hostingbilling.net', '1.0', 'Domains Registrar Integration', 'Hosting Billing', 'www.hostingbilling.net', ''),
(16, 'hexonet', 'Hexonet', 'Domain Registrars', 1, 'http://www.hostingbilling.net', '1.0', 'Hexonet Registrar Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(17, 'instamojo', 'Instamojo', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Instamojo Payment Gateway', 'Hosting Billing', 'www.hostingbilling.net', ''),
(18, 'internetbs', 'Internetbs', 'Domain Registrars', 1, 'http://www.hostingbilling.net', '1.0', 'Internt.bs Registrar Integration', 'Hosting Billing', 'www.hostingbilling.net', ''),
(19, 'mollie', 'Mollie', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Mollie Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(20, 'namecheap', 'Namecheap', 'Domain Registrars', 1, 'http://www.hostingbilling.net', '1.0', 'Namecheap Registrar Integration', 'Hosting Billing', 'www.hostingbilling.net', ''),
(21, 'payfast', 'Payfast', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Payfast Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(22, 'paypal', 'Paypal', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Paypal Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(23, 'paystack', 'Paystack', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Paystack Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(24, 'razorpay', 'Razorpay', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Razorpay Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(25, 'resellerclub', 'Resellerclub', 'Domain Registrars', 1, 'http://www.hostingbilling.net', '1.0', 'ResellerClub Registrar Integration', 'Hosting Billing', 'www.hostingbilling.net', ''),
(26, 'stripepay', 'Stripepay', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'Stripepay Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(27, 'whoisxmlapi', 'Whoisxmlapi', 'Domain Availability', 1, 'http://www.hostingbilling.net', '1.0', 'Whois XML API Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(28, 'aamarpay', 'aamarPay', 'Payment Gateways', 1, 'http://www.hostingbilling.net', '1.0', 'aamarPay Payment Gateway.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(29, 'namesilo', 'Namesilo', 'Domain Registrars', 1, 'http://www.hostingbilling.net', '1.0', 'Namesilo Registrar Integration.', 'Hosting Billing', 'www.hostingbilling.net', ''),
(30, 'synergywholesale', 'SynergyWholesale', 'Domain Registrars', 1, 'http://www.hostingbilling.net', '1.0', 'Synergy Wholesale Registrar Integration.', 'Hosting Billing', 'www.hostingbilling.net', '');

 
ALTER TABLE `hd_plugins`
  ADD PRIMARY KEY (`plugin_id`);
 
ALTER TABLE `hd_plugins`
  MODIFY `plugin_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31; 


INSERT INTO `hd_hooks` (`module`, `parent`, `hook`, `icon`, `name`, `route`, `order`, `access`, `core`, `visible`, `permission`, `enabled`, `last_run`) VALUES ('menu_plugins', 'menu_system', 'main_menu_admin', 'fa-cloud-download', 'plugins', 'plugins', '1', '1', '1', '1', '', '1', '1000-10-10 10:10:10'); 
