Tune build config migration (#8931)
* Tune build config migration
Use the hacked up script that we ran in place of the migration. We hit
issues with a simple `.update()` backing up queries in production, so
ended up running this script instead. Mostly just archiving this logic
in case we ever want to come back to this.
* Fix migration for tests
* Fix conditional logic on migration