START TRANSACTION;
INSERT INTO `tblplan_features` (`name`, `codename`, `description`, `type`, `added_on`, `is_highlight`) VALUES ('Integrate with EarthCam', 'earthcam_integration_allowed', 'Connect with EarthCam to show your clients work progress video feed.', 'allow', NOW(), 1);
SET @allow_request_changes_id = LAST_INSERT_ID();
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `other_data`, `added_on`) VALUES ('9', @allow_request_changes_id, '0', '{"outside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate.","inside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https://my.contractorplus.app/","count":"0"}', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `other_data`, `added_on`) VALUES ('10', @allow_request_changes_id, '0', '{"outside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate.","inside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https://my.contractorplus.app/","count":"0"}', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `other_data`, `added_on`) VALUES ('11', @allow_request_changes_id, '0', '{"outside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate.","inside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https://my.contractorplus.app/","count":"0"}', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('12', @allow_request_changes_id, '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `other_data`, `added_on`) VALUES ('13', @allow_request_changes_id, '0', '{"outside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate.","inside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https://my.contractorplus.app/","count":"0"}', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `other_data`, `added_on`) VALUES ('14', @allow_request_changes_id, '0', '{"outside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate.","inside_message":"EarthCam Live Feed URL is an Ultimate Feature. In order to enable this, Upgrade to Ultimate","tag_color":"#eb0e0e","tag_title":"UPGRADE","link":"https://my.contractorplus.app/","count":"0"}', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('15', @allow_request_changes_id, '1', UTC_TIMESTAMP());

UPDATE tblstaff SET refresh_permissions = 1;

CREATE TABLE `tblearthcam_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('pending','in_progress','completed','failed') NOT NULL DEFAULT 'pending',
  `filters` longtext DEFAULT NULL,
  `added_on` datetime NOT NULL,
  `added_by` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
ALTER TABLE `tblearthcam_jobs`
  ADD PRIMARY KEY (`id`);
ALTER TABLE `tblearthcam_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;


CREATE TABLE `tblclientproperties_earthcam` (
    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `tenant_id` BIGINT(20) NULL  ,
    `property_id` BIGINT(20) NULL  ,
    `project_name` VARCHAR(200) NULL ,
    `server_id` VARCHAR(255) NULL ,
    `server_name` VARCHAR(200) NULL ,
    `feed_url` TEXT NULL ,
    `feed_thumbnail` TEXT NULL ,
     `added_on` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ,
     PRIMARY KEY (`id`),
     KEY `tenant_id` (`tenant_id`),
     KEY `property_id` (`property_id`)
     ) ENGINE = INNODB;

COMMIT;