CREATE TABLE approvals (
    id BIGSERIAL PRIMARY KEY,
    approvable_type VARCHAR(50) NOT NULL,
    approvable_id BIGINT NOT NULL,
    step SMALLINT NOT NULL,
    status VARCHAR(20) NOT NULL,
    notes TEXT,
    created_at TIMESTAMPTZ DEFAULT NOW() NOT NULL,
    action_by BIGINT REFERENCES users (id) ON DELETE SET NULL ON UPDATE CASCADE
);

CREATE INDEX approvals_approvable_lookup ON approvals (approvable_type, approvable_id);
