CREATE TABLE tbltenant_companycam_sync(
    id BIGINT(20) NOT NULL AUTO_INCREMENT,
    tenant_id BIGINT(20) NOT NULL,
    cc_project_id BIGINT(20) NOT NULL,
    rel_type VARCHAR(20) NOT NULL,
    rel_id BIGINT(20) NOT NULL,
    rel_attachment_id BIGINT(20) NULL,
    cc_attachment_url TEXT NULL,
    cc_attachment_id BIGINT(20) NULL,
    attachment_type VARCHAR(20) NULL,
    created_at DATETIME NOT NULL,
    PRIMARY KEY(id)
);


INSERT INTO `tblapad_emailtemplates` (`emailtemplateid`, `type`, `slug`, `language`, `name`, `subject`, `message`, `fromname`, `fromemail`, `plaintext`, `active`, `order`, `is_tenant_email_config_allowed`, `is_tenant`) VALUES (NULL, 'companycam_expired', 'companycam-expired', "English", 'CompanyCam authorization expired', 'CompanyCam authorization expired', '<span style=\"font-size: 12pt;\">Hi {tenant_first_name},</span><br/><br/><span style=\"font-size: 12pt;\">You had your CompanyCam linked to Contractor+ via Settings > CompanyCam.</span><br/><br/><span style=\"font-size: 12pt;\">We noticed the link is no longer working. This could be due to an expired token, a changed password, or for a routine security checkup. Please login to Contractor+ and re-authorize your CompanyCam account ASAP to avoid any interruption in this service.</span><br/><br/><span style=\"font-size: 12pt;\">Regards,</span><br/><br/><span style=\"font-size: 12pt;\">Contractor+ App</span><br/><span style=\"font-size: 12pt;\">www.contractorplus.app</span>', '', NULL, '0', '1', '0', '0', '0');

INSERT INTO `tblplan_features` (`name`, `codename`, `description`, `type`, `added_on`) VALUES ('CompanyCam Sync', 'companycam_sync', 'CompanyCam Sync', 'restrict', NOW());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('9', '108', '0', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('10', '108', '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('11', '108', '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('12', '108', '1', UTC_TIMESTAMP());

UPDATE tblstaff SET refresh_permissions = 1;