a8n: Add Title/Body to Changesets in GraphQL API
Created by: mrnugget
This change adds the title
and body
fields to the Changeset
in the GraphQL API.
It does this by adding an external_service_type
column to changesets
and populating it with the value of the column of the same name from repo
. We decided that duplicating this data is more economic than using a JOIN
on every SELECT
.
The marshaling/unmarshaling of the Metadata
uses the same technique that we previously used in repo-updater
: when we scan a changesets
row returned from the database, we look at the external_service_type
column to determine in which codehost specific struct we should unmarshal the metadata jsonb
column. Right now we only support GitHub and in case external_service_type == "github"
we turn changeset.Metadata
into a *github.PullRequest
.
The changesetResolver
then has to do a typeswitch on Metadata
to determine how to get to fields like Title
and Body
.