CREATE TABLE IF NOT EXISTS repo_webhook_delivery (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    repo UUID NOT NULL REFERENCES repo(id),
    webhook UUID NOT NULL REFERENCES repo_webhook(id),
    event TEXT NOT NULL,
    request_headers TEXT,
    request_body TEXT,
    response_status INTEGER,
    response_headers TEXT,
    response_body TEXT,
    error TEXT,
    delivered_at TIMESTAMPTZ,
    created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
