Dbmate runs all files sorted by filename, so we have to number our files. But when two pull requests introduce a migration with the same number, we want to make an explicit choice about which one comes first; they might interact, and aside from that, we should not insert a migration in the middle because somebody might have executed the first migration already.
We can avoid this problem by naming files only after numbers, but then we can't have descriptive names. So instead, enforce on CI that migration numbers are unique.
Example output:
Error: Migration 0002 is not unique:
- 0002-foo.sql
- 0002-bar.sql
Dbmate runs all files sorted by filename, so we have to number our files. But when two pull requests introduce a migration with the same number, we want to make an explicit choice about which one comes first; they might interact, and aside from that, we should not insert a migration in the middle because somebody might have executed the first migration already.
We can avoid this problem by naming files only after numbers, but then we can't have descriptive names. So instead, enforce on CI that migration numbers are unique.
Example output: