CREATE TABLE IF NOT EXISTS tblcalendar_events (
    id BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
    tenant_id BIGINT UNSIGNED NOT NULL,
    FOREIGN KEY (tenant_id) REFERENCES tbltenants (id) ON DELETE CASCADE,
    title VARCHAR(191) DEFAULT NULL,
    description TEXT DEFAULT NULL,
    start_date DATE NOT NULL,
    end_date DATE NOT NULL,
    start_time TIME DEFAULT NULL,
    end_time TIME DEFAULT NULL,
    is_any_time TINYINT(1) DEFAULT 0,
    is_repetitive TINYINT(1) DEFAULT 0,
    first_event_id BIGINT UNSIGNED DEFAULT NULL,
    repeat_frequency VARCHAR(191) DEFAULT NULL,
    repeat_value INT UNSIGNED DEFAULT NULL,
    repeat_value_type VARCHAR(191) DEFAULT NULL,
    added_on DATETIME NOT NULL,
    added_by BIGINT UNSIGNED NOT NULL,
    FOREIGN KEY (added_by) REFERENCES tblstaff (staffid) ON DELETE CASCADE,
    updated_on DATETIME NOT NULL,
    updated_by BIGINT UNSIGNED NOT NULL,
    FOREIGN KEY (updated_by) REFERENCES tblstaff (staffid) ON DELETE CASCADE
) ENGINE=INNODB DEFAULT CHARSET=utf8;



ALTER TABLE `tbljob_visits` ADD `g_calendar_id` VARCHAR(255) DEFAULT NULL