CREATE TABLE IF NOT EXISTS mail_saved_searches (
    id           BIGSERIAL PRIMARY KEY,
    tenant_slug  TEXT NOT NULL,
    user_id      TEXT NOT NULL,
    name         TEXT NOT NULL,
    query_text   TEXT NOT NULL DEFAULT '',
    filters      JSONB NOT NULL DEFAULT '[]'::jsonb,
    created_at   TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at   TIMESTAMPTZ NOT NULL DEFAULT now(),
    UNIQUE (tenant_slug, user_id, name)
)
