K
K
ksdaemon2010-11-03 17:33:35
MySQL
ksdaemon, 2010-11-03 17:33:35

How to synchronize MySQL database version and web application code when developing?

Initial data:
1) a web application in php (well, it doesn't matter what language) located in git (well, or another CVS)
2) MySQL database
3) All SQL code is stored in the database in the form of stored procedures.

How to keep application code and database structure and stored procedures in sync?
With procedures, of course, the situation is simpler - you can put each procedure in a separate file that is tracked in git (well, or another CVS)
But what about the table structure? It is laborious to generate handles with each change of ALTER TABLE and put them in separate files.
Maybe there are some utilities that allow you to do this automatically, a la Oracle Database Version Control?
I would like to be able, when updating the application version, to execute one sql script that will update the database. If of course this is possible.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry Sergeev, 2010-11-03
@JetMaster

habrahabr.ru/qa/1518/

S
slang, 2010-11-04
@slang

If you are in PHP, try Doctrine, this ORM supports very convenient migrations. You can also use some kind of Capistrano-type deployment tool, but the meaning still comes down to the consistent use of ALTER constructs, albeit not quite manually.

C
casey, 2010-11-04
@casey

Look here - habrahabr.ru/qa/1518/

B
borisiq, 2010-11-04
@borisiq

For the database, you can look at the tools at www.sqlaccessories.com/ - I can’t say about prices how expensive or cheap it is. For MS SQL, I personally used it in the project; support for other databases, including MySQL, is also declared. The scripts generated by the program can be stored in SVN as ordinary text files. Actually, you can store binary files, only viewing changes will probably be unavailable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question