How about multiple engineers making schema changes simultaneously?
How is a diff really much different from a migration?
How about multiple engineers making schema changes simultaneously?
How is a diff really much different from a migration?
- check schema version number, if newer version exists, apply migration files
to:
- check schema on this branch matches production schema exactly, if it doesn't, look for (one or more) pending migration files that would bring production to target state, apply those files
So you can still have multiple migration files as needed. The differences:
- no version numbers
- no long migration chain (you can clean up old pending files once they've hit prod)
- migrations are tested directly, and only get applied if a correct outcome will result
It's impossible to handle every case, of course, such as when renames happen or data needs to be moved/inserted.
Migration scripts always need reviewing. Tools can get you most of the way there automatically, and help you test, but not all of the way.