CREATE TABLE IF NOT EXISTS pull_request (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    repo UUID NOT NULL,
    number BIGINT NOT NULL,
    title TEXT NOT NULL,
    body TEXT,
    state TEXT NOT NULL DEFAULT 'open',
    draft BOOLEAN NOT NULL DEFAULT FALSE,
    author UUID NOT NULL,
    source_repo UUID NOT NULL,
    source_branch TEXT NOT NULL,
    source_sha TEXT NOT NULL,
    target_branch TEXT NOT NULL,
    target_sha TEXT NOT NULL,
    merged_by UUID,
    merged_at TIMESTAMPTZ,
    closed_by UUID,
    closed_at TIMESTAMPTZ,
    created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
    deleted_at TIMESTAMPTZ
);
