CREATE TABLE `tblin_app_logs` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `tenant_id` bigint unsigned NOT NULL,
    FOREIGN KEY (tenant_id) REFERENCES tbltenants(id),
    `staff_id` bigint unsigned NOT NULL,
    FOREIGN KEY (staff_id) REFERENCES tblstaff(staffid),
    `for` varchar(100) NOT NULL,
    `client_id` bigint unsigned NULL,
    `rel_type` varchar(100) NOT NULL,
    `rel_id` bigint unsigned NULL,
    `action` varchar(100) NOT NULL,
    `priority` int DEFAULT 9999,
    `description` text NOT NULL,
    `marked_as_read` tinyint DEFAULT 0,
    `is_actionable_item` tinyint DEFAULT 0,
    `actionable_item_title` text NOT NULL,
    `marked_as_done` tinyint DEFAULT 0,
    `is_item_deleted` tinyint DEFAULT 0,
    `additional_data` longtext NULL,
    `action_performed_by` varchar(100) NOT NULL,
    `action_performed_by_id` bigint unsigned NOT NULL,
    `display_on` datetime NOT NULL,
    `added_on` datetime NOT NULL,
    `modified_on` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `tblnotifications_preferences` (
    `id` bigint unsigned NOT NULL AUTO_INCREMENT,
    `tenant_id` bigint unsigned NOT NULL,
    FOREIGN KEY (tenant_id) REFERENCES tbltenants(id),
    `action` varchar(100) NOT NULL,
    `push_notification` tinyint DEFAULT 0,
    `email` tinyint DEFAULT 0,
    `additional_data` longtext NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO tblnotifications_preferences (tenant_id, action, push_notification) VALUES (468, 'new_invoice_created_staff', 1);