MySQL schema in source control (SVN)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
LonelyProgrammer
Forum Contributor
Posts: 108
Joined: Sun Oct 12, 2003 7:10 am

MySQL schema in source control (SVN)

Post by LonelyProgrammer »

Hi all,

Our team is currently using xamp and localhost development (there is no in-office LAN...yet), and are using SVN for source-control. However, one problem I am running into is that when I create a new table, I have to send the query to other in the team so that their localhost DB can be up to date. One solution is to have a remote DB which everyone connects to, but as everyone try out new code and do tests, it would be cluttered and filled with test data.

I m thinking if it is possible somehow to sync MySQL through SVN somehow. How are changes to a database schema usually propagated from the test DB to the live DB?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: MySQL schema in source control (SVN)

Post by Eran »

An approach that we use is to store all schema changing queries in a text file. We commit those files along with regular commits, and other team members can then run those queries to obtain the updated state of the database schema. You could use a post-commit to automatically run the schema changes from the new files if you wish.
Post Reply