CREATE TABLE tblstaff_rate_prompt_level(
    id BIGINT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
    tenant_id BIGINT UNSIGNED NOT NULL,
    FOREIGN KEY (tenant_id) REFERENCES tbltenants(id) ON DELETE CASCADE ON UPDATE CASCADE,
    staff_id BIGINT UNSIGNED NOT NULL,
    FOREIGN KEY (staff_id) REFERENCES tblstaff(staffid) ON DELETE CASCADE ON UPDATE CASCADE,
    level_no TINYINT(4) NOT NULL DEFAULT 1,
    level_updated_on DATETIME NOT NULL
);

ALTER TABLE `tblstaff` ADD `show_app_rating_popup` TINYINT(1) NOT NULL DEFAULT '0' AFTER `review_updated_at`;

INSERT INTO `tblapad_options`(`type`, `name`, `value`) VALUES
    ('app_rating_popup_level_1', 'no_of_estimates', '2'),
    ('app_rating_popup_level_2', 'no_of_estimates', '5'),
    ('app_rating_popup_level_3', 'no_of_estimates', '8');

INSERT INTO `tblapad_options`(`type`, `name`, `value`) VALUES
    ('app_rating_popup_level_1', 'no_of_invoices', '2'),
    ('app_rating_popup_level_2', 'no_of_invoices', '5'),
    ('app_rating_popup_level_3', 'no_of_invoices', '8');

INSERT INTO `tblapad_options`(`type`, `name`, `value`) VALUES
    ('app_rating_popup_level_1', 'no_of_clients', '5'),
    ('app_rating_popup_level_2', 'no_of_clients', '10'),
    ('app_rating_popup_level_3', 'no_of_clients', '15');

INSERT INTO `tblapad_options`(`type`, `name`, `value`) VALUES
    ('app_rating_popup_level_1', 'no_of_leads', '5'),
    ('app_rating_popup_level_2', 'no_of_leads', '10'),
    ('app_rating_popup_level_3', 'no_of_leads', '15');

INSERT INTO `tblapad_options`(`name`, `value`) VALUES ('show_app_rating_popup_after_hr', '72');