Add external services repos table
Created by: asdine
This PR adds support for a new table external_service_repos
which contains the relationship between a repository and external services. That relationship, also known as source
, is currently stored in the repo
table in the sources
column. This PR adds a migration script that migrates that column to the new table.
Notable changes:
- New
UpsertSources
method added to the Repo updater store. This method is called by the syncer whenever repos must be updated. -
UpsertRepos
no longer updates the source column, a call toUpsertSources
must be operated every time we want to update them. I guess that as long as this is kept within repo-updater it's fine, otherwise it will become a problem. An other solution would be to push everything insideUpsertRepos
, but it seems more complex because we need the previous state to compute the diff of the sources. - Tests now create actual external services before running, and remove them right after. This was done because the
external_service_repos
table has two foreign key policies on external services and repositories.
Closes: https://github.com/sourcegraph/sourcegraph/issues/12711