ALTER TABLE `tblleads` ADD `address_2` VARCHAR(100) NULL DEFAULT NULL AFTER `address`;

INSERT INTO `tbloptions_static` (`id`, `name`, `value`, `autoload`) VALUES (NULL, 'lead_prefix', 'LD-', '1');
INSERT INTO `tbloptions_static` (`id`, `name`, `value`, `autoload`) VALUES (NULL, 'next_lead_number', '1', '0');
INSERT INTO `tbloptions_static` (`id`, `name`, `value`, `autoload`) VALUES (NULL, 'lead_format', '1', '1');

ALTER TABLE `tblleads` ADD `number` BIGINT NULL AFTER `id`;
ALTER TABLE `tblleads` ADD `prefix` VARCHAR(50) NULL DEFAULT NULL AFTER `number`;
ALTER TABLE `tblleads` ADD `number_format` BIGINT NULL AFTER `prefix`;

INSERT INTO `tbloptions` (`tenant_id`, `id`, `name`, `value`, `autoload`) VALUES (1, NULL, 'lead_prefix', 'LD-', '1');
INSERT INTO `tbloptions` (`tenant_id`, `id`, `name`, `value`, `autoload`) VALUES (1, NULL, 'next_lead_number', '1', '0');
INSERT INTO `tbloptions` (`tenant_id`, `id`, `name`, `value`, `autoload`) VALUES (1, NULL, 'lead_format', '1', '1');

CREATE TABLE tbl_leads_conversations(
	id BIGINT(20) UNSIGNED PRIMARY KEY AUTO_INCREMENT,
    tenant_id BIGINT(20) UNSIGNED NOT NULL,
    lead_id BIGINT(20) UNSIGNED NOT NULL,
    conversation LONGTEXT NOT NULL,
    status BIGINT(20) NOT NULL,
    staff_id BIGINT(20) UNSIGNED NOT NULL,
    conversation_date DATETIME NOT NULL,
    added_by BIGINT(20) UNSIGNED NOT NULL,
    added_on DATETIME NOT NULL,
    modified_by BIGINT(20) UNSIGNED NOT NULL,
    modified_on DATETIME NOT NULL
);
