DB migration steps should always be re-entrant. This way, if the server is suddenly stopped or crashes, the migration can be resumed.
For example, if step 1234 is being executed when the server stops, upon restart the server should see that step 1233 was completed and start doing step 1234 again.
We often write the migration steps in a re-entrant way, but not always.
To complete this ticket, we should:
- Ensure that we have all the tools to write re-entrant migration steps (functions to check if a column or table already exists, etc).
- Ideally, have the tests run each migration twice.
- Fix the existing migrations if needed.