What is the best way to maintain database version control using yii php framework?

Based on the world of rubies in rails, I am looking for an effective way to version my database (in the case of rails, migration serves this purpose).

I am currently taking database snapshots and exporting the entire schema on a regular basis, but the whole process is pretty manual.

Is there a better way to do this?

ps I am using mysql.

+4
source share
2 answers

In Yii 1.1.6, the concept of database migration will exist. This will allow us to manipulate the databases in a DB-agnostic way using PHP code. See http://code.google.com/p/yii/issues/detail?id=1191 for more details.

+4
source

Basically: NO . Not something with php.

HOWEVER ... A consistent scheme, for example, from the SHOW CREATE <table_name>; command SHOW CREATE <table_name>; is still a reliable way to do what you are talking about - if it is rather nontrivial in nature. You must be very knowledgeable about the details in the mechanics of defining a circuit if you want to detect and reproduce this. However, you can develop a custom field that keeps track of the version number that you update when updating the schema. Then at least you should know when to update other replication goals - by comparing the data in this version field.

As I usually saw, this is implemented to track all ALTER TABLE commands (etc.) and track them. You can check something like the "r12345.sql" file in SVN for the db automatic update system. This is due to the fact that I mean that php script can check all .sql db schema files and execute each of them (sequentially), which will reproduce the changes in the current database.

A lot depends on what you are trying to accomplish. If you provide more information, I would outline.

0
source

All Articles