DEV Community

Discussion on: How to properly manage migration files

Collapse
 
claudiodavi profile image
Claudio Davi

Back at my previous workplace we had a folder inside the project (on git) which contained the scripts that should be executed in order to keep our databases in sync.
Sort of like this:

version/dbprovider/query_alias.sql
0.1Beta/mysql/update_usertable_timestamp.sql

Then we had a tool that would get the version that you wanted to go, and execute all the scripts that you did not have until you got to your desired version. This tool used the database for two purposes: Save all the files that were already executed and most importantly, execute missing queries.