Let me start off by saying, I like to have my development database full of data while working on a project. It lets me visualize the end result a lot easier. Whether that’s good practice or not is another story.
I’m working on a project that has some pretty text heavy data. It became a huge pain in the ass to replicate the data I had on each machine I work on. So I came up with a super simple solution. I use Git and MySQL, so I combined the 2 into easy shell commands.
Add these to :
1 function gg() { 2 mysqldump -u user --skip-extended-insert database_name > ./sql/database_name.sql 3 git commit -v -a -m "$*" 4 }
. First it dumps out the contents of your database into a file, then, assuming is already in your Git index, it will commit everything, database contents and all.
The next part of this is the component on the opposite end, the part:
1 function gl() { 2 git pull 3 mysql -u user database_name < ./sql/database_name.sql 4 }
Now you can call and it will first pull down any new stuff from your upstream Git repo, then apply the to your database.
This is a very dirty way of doing it, but it works pretty well for me.