Add external services repos table
Created by: asdine
The original PR #12789 failed to be deployed because of a migration error that was caused because of a deadlock (see https://sourcegraph.slack.com/archives/CMBA8F926/p1597923638000300 for more context).
This PR changes several things to the migration, these changes can be seen in this commit https://github.com/sourcegraph/sourcegraph/commit/7481ec8a8e7ba1ebd83a5b9927125c58e666e1cc:
- Acquire an exclusive table lock before the migration
- Make the sources column read-only, using a trigger, instead of removing it.
- Run the migration code only on non deleted repos
The script was tested on production, with a rollback instead of a commit, and it took 1m25s