Skip to content

Add unique constraint on batch changes table

Administrator requested to merge es/unique-bcs into main

Created by: eseliger

Now that there are multiple entry points to creating a batch change, we figured it'd be safer to have a unique constraint in place here. There are certainly some race conditions that can cause duplicates to happen and we currently handle those very poorly.

Closes https://github.com/sourcegraph/sourcegraph/issues/29164

Test plan

We have a big test suite around all the mutations that could be affected by this, and I did some manual test runs both on the DB layer and from the app to verify this doesn't break anything. To be clear, this already had proper error handling in place, this is just guarding the application layer checks for race conditions.

Merge request reports

Loading