CREATE TABLE IF NOT EXISTS mail_rules (
    id                       BIGSERIAL PRIMARY KEY,
    tenant_slug              TEXT NOT NULL,
    name                     TEXT NOT NULL,
    sender_pattern           TEXT NOT NULL DEFAULT '',
    subject_pattern          TEXT NOT NULL DEFAULT '',
    mailbox_pattern          TEXT NOT NULL DEFAULT '',
    attachment_type_pattern  TEXT NOT NULL DEFAULT '',
    category                 TEXT NOT NULL DEFAULT '',
    tag                      TEXT NOT NULL DEFAULT '',
    priority                 INT NOT NULL DEFAULT 100,
    created_at               TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at               TIMESTAMPTZ NOT NULL DEFAULT now()
)
