View Full Version : What is the best way to Version Control a Database?

03-02-2009, 08:49 AM
I am thinking of using either SVN or GIT to do version control on my mysql database. Some people suggest to dump the database into a text file, and version control the text file. Is there a better method? Version control software usually don't detect change of data in the database, so I have to constantly remind myself to do it manually.

03-02-2009, 04:50 PM
I would definitely do the schema like that; dump the create queries and store in a text file. At any given point along development you should be able to create the entire database from these create queries and the database should then correspond to the application code.

As for actual data in the tables... during development I usually keep test data in a separate text file (via INSERT queries for easy database rebuild) and once the application goes live, of course, the live data is backed up daily (not through SVN).