DROP TABLE IF EXISTS ohs_alert_rules2alert_recipients;
DROP TABLE IF EXISTS alert_recipients;
DROP TABLE IF EXISTS ohs_alert_rules;

CREATE TABLE incident_alert_rules (
    id SERIAL,
    incident_type_id INTEGER DEFAULT NULL,
    severity varchar(50) DEFAULT NULL,
    send_alert_to INTEGER DEFAULT NULL,
    email varchar(255) DEFAULT NULL,
    send_email BOOLEAN DEFAULT FALSE,
    phone varchar(50) DEFAULT NULL,
    send_sms BOOLEAN DEFAULT FALSE,
    send_push BOOLEAN DEFAULT FALSE,
    tenant_id INTEGER DEFAULT NULL,
    branch_id INTEGER DEFAULT NULL,
    isDeleted BOOLEAN NOT NULL DEFAULT FALSE,
    updatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id)
);
