3

What tools are you using to track changes in your MySQL database?
Currently I'm in a project where we use a plain text-file (version controlled via SVN) in which we manually add SQL statements when making changes to the database.
Many of the changes magically disappears every now and then, and we are now looking for a better way to change track our database.

EDIT:
One thing that I forgot to mention, we are using stored procedures and functions, so it's not only the database structure that we want to track changes on / version controll.

fredrik
  • 13,282
  • 4
  • 35
  • 52
  • I just ask a very similar question recently: http://stackoverflow.com/questions/755704/starting-with-versioning-mysql-schemata-without-overkill-good-solutions – markus Apr 18 '09 at 12:05

4 Answers4

8

There is a simple solution:

  • Make all changes to the database schema and static data via scripts
  • Version control the scripts
  • Hi! Thanks for your answer, however, I dont see how this is different from what we are currently doing? please explain more, I might just be missing the point. – fredrik Apr 18 '09 at 12:43
  • Is the plain text file actually run against the database (.e. is is used as a script)? From your question, I got the impression it was just a record of changes. –  Apr 18 '09 at 12:55
  • When I make a change to the DB, I add the alter table sql (or create prcedure or what ever it might be) statement to this plain-text file, and then my colleagues will run these statements against their local databases, but sometimes it is forgotten.. and sometimes it's forgotten to be added to the version-controlled file. But I'm starting to get what you mean I think, adding the changes to the scriptfile, and the run it against my own local database? – fredrik Apr 18 '09 at 13:09
  • Yes, run the actual file against the database - don't try to copy & paste the contents into your mysql client app. To do this properly, only one person should have rights to change the production database schema - that's the person you then blame when things go wrong :-) –  Apr 18 '09 at 13:29
  • I ended up making a solution based in you idea. I made a folder structure representing the database, e.g Database/DatabaseName/Procedures/ProcedureName.sql and Database/DatabaseName/Tables/TabelName.sql, then I made a PHP script that will run all the .sql scripts in the right place in the database.. so far it seems like it will work :) Thanks. – fredrik Apr 19 '09 at 17:25
1

Toad for MySQL has a great schema comparison tool

http://www.quest.com/toad-for-mysql/

Petah
  • 45,477
  • 28
  • 157
  • 213
0

mysql-diff compares tables, but not stored procedures yet.

stepancheg
  • 4,262
  • 2
  • 33
  • 38
0

I think you need something like this (I test it for Firebird and it works very well) : http://www.upscene.com/products.audit.index.php I thought there was a MySQL version but NO :(

for MySQL, I see just this : http://solutions.mysql.com/solutions/partner.php?partner=1532

But if it is just for development, I think that the answer given here is good

Community
  • 1
  • 1
Hugues Van Landeghem
  • 6,755
  • 3
  • 34
  • 59