Mysql-Stash - quickly stash and reapply the state of your MySQL database

2018, Jul 30    

As the development team continues to grow in my workplace, I find myself required to perform more and more code reviews/pull requests. A part of our code review process is also testing the functionality of the pull request to ensure that it performs as expected, which is a part of our companies process for merging in new code alongside unit and behavioural testing.

Some new features require database migrations to be performed or for databases to be reset to fixtures in order to test a feature, as such I had the idea to create a small utility for storing the state of your database in “stashes”.

The idea behind the app is fairly simple, just take an SQL dump and store it to a file with the given “stash” name. When the app is asked to restore the “stash” it simply runs the SQL queries saved in the plain text file.

The package can be found here:

https://github.com/motomod/mysql-stash