3 ms·
If one of the many schema migration solutions out there doesn't work for you, hacking one together is simple enough: * Put your schema/data migrations into .sq
by lastofus 11y ago
If one of the many schema migration solutions out there doesn't work for you, hacking one together is simple enough:
* Put your schema/data migrations into .sql files as raw SQL
* Number the files from 0001 on
* Write a script to apply each migration file to the DB in order, recording the file name to a log table after successful application. Only apply migrations not found in the log table.
* Commit your .sql migration files along with the code it is tied to.
- guh_me 11y agoThat's a good approach - I've used it in a legacy system, although I named the files in the format "TIMESTAMP_migration_description", which is a bit more descriptive.