ALTER TABLE `tblpost_inspections` CHANGE `post_inspection_status` `post_inspection_status` ENUM('pending','completed','cancelled','in-complete','incomplete') CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT 'incomplete';

UPDATE tblpost_inspections SET tblpost_inspections.post_inspection_status = 'incomplete' WHERE tblpost_inspections.post_inspection_status = 'in-complete' OR tblpost_inspections.post_inspection_status = '';

CREATE TABLE `tblpayments_calculation` ( `uniquecode` VARCHAR(191) NOT NULL , `tenant_id` BIGINT(20) UNSIGNED NOT NULL , `payment_related_data` TEXT NOT NULL , PRIMARY KEY (`uniquecode`)) ENGINE = InnoDB;

INSERT INTO `tblplan_sets` (`id`, `plan_set_name`, `plan_set_description`, `start_date`, `end_date`, `reason_for_switching_plan`, `is_active`, `is_promotional`, `added_on`) VALUES (NULL, 'Free promotional plans', 'Free promo', NULL, NULL, NULL, '1', '1', current_timestamp());

ALTER TABLE `tblplans`  ADD `plan_promotional_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `stripe_data`,  ADD `plan_promotional_free_period_in_days` INT(8) NULL DEFAULT NULL  AFTER `plan_promotional_price`,  ADD `plan_promotional_frequency` ENUM('both','yearly','monthly','lifetime') NULL DEFAULT NULL  AFTER `plan_promotional_free_period_in_days`,  ADD `plan_promotional_monthly_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_frequency`,  ADD `plan_promotional_yearly_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_monthly_price`,  ADD `plan_promotional_monthly_to_yearly_discount` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_yearly_price`,  ADD `plan_promotional_off_percent_in_amount` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_monthly_to_yearly_discount`,  ADD `plan_promotional_off_percent_fr_days` INT(8) NULL DEFAULT NULL  AFTER `plan_promotional_off_percent_in_amount`,  ADD `plan_promotional_off_stripe_coupon` VARCHAR(191) NULL DEFAULT NULL  AFTER `plan_promotional_off_percent_fr_days`;

ALTER TABLE `tbltenant_plan_information`  ADD `plan_promotional_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `stripe_subscription_id`,  ADD `plan_promotional_free_period_in_days` INT(8) NULL DEFAULT NULL  AFTER `plan_promotional_price`,  ADD `plan_promotional_frequency` ENUM('both','yearly','monthly','lifetime') NULL DEFAULT NULL  AFTER `plan_promotional_free_period_in_days`,  ADD `plan_promotional_monthly_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_frequency`,  ADD `plan_promotional_yearly_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_monthly_price`,  ADD `plan_promotional_monthly_to_yearly_discount` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_yearly_price`,  ADD `plan_promotional_off_percent_in_amount` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_monthly_to_yearly_discount`,  ADD `plan_promotional_off_percent_fr_days` INT(8) NULL DEFAULT NULL  AFTER `plan_promotional_off_percent_in_amount`,  ADD `plan_promotional_off_stripe_coupon` VARCHAR(191) NULL DEFAULT NULL  AFTER `plan_promotional_off_percent_fr_days`;

ALTER TABLE `tbltenant_plan_changes_history`  ADD `plan_promotional_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `stripe_subscription_id`,  ADD `plan_promotional_free_period_in_days` INT(8) NULL DEFAULT NULL  AFTER `plan_promotional_price`,  ADD `plan_promotional_frequency` ENUM('both','yearly','monthly','lifetime') NULL DEFAULT NULL  AFTER `plan_promotional_free_period_in_days`,  ADD `plan_promotional_monthly_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_frequency`,  ADD `plan_promotional_yearly_price` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_monthly_price`,  ADD `plan_promotional_monthly_to_yearly_discount` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_yearly_price`,  ADD `plan_promotional_off_percent_in_amount` DECIMAL(8,2) NULL DEFAULT NULL  AFTER `plan_promotional_monthly_to_yearly_discount`,  ADD `plan_promotional_off_percent_fr_days` INT(8) NULL DEFAULT NULL  AFTER `plan_promotional_off_percent_in_amount`,  ADD `plan_promotional_off_stripe_coupon` VARCHAR(191) NULL DEFAULT NULL  AFTER `plan_promotional_off_percent_fr_days`;

ALTER TABLE `tblplans` CHANGE `description` `description` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL;

ALTER TABLE `tblplans` CHANGE `monthly_price` `monthly_price` DECIMAL(10,0) NULL DEFAULT NULL;

ALTER TABLE `tblplans` CHANGE `yearly_price` `yearly_price` DECIMAL(10,0) NULL DEFAULT NULL;

ALTER TABLE `tblplans` CHANGE `plan_monthly_to_yearly_discount` `plan_monthly_to_yearly_discount` DECIMAL(10,0) NULL DEFAULT NULL;

ALTER TABLE `tblplans` CHANGE `is_base_plan_of_set` `is_base_plan_of_set` TINYINT(4) NULL DEFAULT NULL;

ALTER TABLE `tblplans` CHANGE `base_plan_frequency` `base_plan_frequency` ENUM('monthly','yearly') CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL;

INSERT INTO `tblplans` (`id`, `plan_sets_id`, `name`, `codename`, `description`, `monthly_price`, `yearly_price`, `plan_monthly_to_yearly_discount`, `is_base_plan_of_set`, `base_plan_frequency`, `is_custom_plan`, `is_popular`, `stripe_data`, `plan_promotional_price`, `plan_promotional_free_period_in_days`, `plan_promotional_frequency`, `plan_promotional_monthly_price`, `plan_promotional_yearly_price`, `plan_promotional_monthly_to_yearly_discount`, `plan_promotional_off_percent_in_amount`, `plan_promotional_off_percent_fr_days`, `plan_promotional_off_stripe_coupon`, `added_on`) VALUES (NULL, '9', 'Lifetime at 100', 'lifetime_100', 'Lifetime at 100', NULL, NULL, NULL, NULL, NULL, '0', '0', '{\r\n  \"product_id\": \"prod_Htm2wfrA1QLbFP\"\r\n}', '100', NULL, 'lifetime', NULL, NULL, NULL, NULL, NULL, NULL, current_timestamp());

UPDATE `tblplans` SET `is_base_plan_of_set` = '1' WHERE `tblplans`.`id` = 9;
UPDATE `tblplans` SET `stripe_data` = '{\r\n  \"product_id\": \"prod_HoriJpMOa2JAsa\",\r\n  \"montly_price_id\": \"price_1HFDz5AZ5BVkab9exu8qwNam\",\r\n  \"yearly_price_id\": \"price_1HFDz5AZ5BVkab9ePF3PpJPH\"\r\n}' WHERE `tblplans`.`id` = 10;
UPDATE `tblplans` SET `stripe_data` = '{\r\n  \"product_id\": \"prod_Horr5AAVEimfkA\",\r\n  \"montly_price_id\": \"price_1HFE7yAZ5BVkab9eTvdQFWir\",\r\n  \"yearly_price_id\": \"price_1HFvlkAZ5BVkab9eF5TKPd2Z\"\r\n}' WHERE `tblplans`.`id` = 11;
UPDATE `tblplans` SET `stripe_data` = '{\r\n  \"product_id\": \"prod_Hos71LCuTkgvJc\",\r\n  \"montly_price_id\": \"price_1HFENOAZ5BVkab9eG5yFFMhI\",\r\n  \"yearly_price_id\": \"price_1HFENOAZ5BVkab9epio3CxCb\"\r\n}' WHERE `tblplans`.`id` = 12;

UPDATE `tblplans` SET `description` = '<ul>\r\n                                        <li><span>2GB</span> Bandwidth</li>\r\n                                        <li><span>150GB</span> Storage</li>\r\n                                        <li><span>12</span> Accounts</li>\r\n                                        <li><span>7</span> Host Domain</li>\r\n                                        <li><span>24/7</span> Support</li>\r\n                                    </ul>' WHERE `tblplans`.`id` = 10;
UPDATE `tblplans` SET `description` = '<ul>\r\n                                        <li><span>2GB</span> Bandwidth</li>\r\n                                        <li><span>150GB</span> Storage</li>\r\n                                        <li><span>12</span> Accounts</li>\r\n                                        <li><span>7</span> Host Domain</li>\r\n                                        <li><span>24/7</span> Support</li>\r\n                                    </ul>' WHERE `tblplans`.`id` = 11;
UPDATE `tblplans` SET `description` = '<ul>\r\n                                        <li><span>2GB</span> Bandwidth</li>\r\n                                        <li><span>150GB</span> Storage</li>\r\n                                        <li><span>12</span> Accounts</li>\r\n                                        <li><span>7</span> Host Domain</li>\r\n                                        <li><span>24/7</span> Support</li>\r\n                                    </ul>' WHERE `tblplans`.`id` = 12;

UPDATE `tblplan_sets` SET `is_active` = '0' WHERE `tblplan_sets`.`id` = 3;
UPDATE `tblplan_sets` SET `is_active` = '1' WHERE `tblplan_sets`.`id` = 7;