S
S
sapp2013-01-15 12:04:03
PHP
sapp, 2013-01-15 12:04:03

Phing + DbDeploy, rollback to previous revision?

The task is to set up more or less automated versioning for databases (MySQL) on web projects. Mercurial is used for the code. I googled the databases for a long time and came up with the Phing+DbDeploy option.

Now there is a problem. Set up Phing+DbDeploy according to the original of this article: habrahabr.ru/post/63585/
But the article does not cover the actual use of the undo functionality. That is, with this setting, there is simply no way to automatically roll back to any of the previous base revisions.

Diligent googling of solutions did not yield results. Has anyone solved this problem? Maybe there are some good alternatives to Phing and DbDeploy? I keep in mind Liquibase, but for now it stops that it requires Java.

Looking forward to your advice guys!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Zhurbitsky, 2013-01-15
@blo

Most likely, you will have to write an auxiliary script in a language convenient for you.
You have all the data for this: the changelog table and the files in the deltas folder.
All that is needed is to compare these two lists (the task of the auxiliary script), for the difference, execute the dbdeploy task and then exec and execute the summary undo script.

D
daeto, 2013-01-15
@daeto

Hmm... Maybe in your case it will be enough to add a full database dump to the task before rolling out a new version and restore it from the dump when you rollback? Or is the database very heavily used and the loss of data during the time required for verification is critical?
If you really want to version the database schema, then it's better to do it using full-fledged migrations (with up() and down()) instead of deltas in one direction. There are different libraries for this, depending on the technologies you use, one or the other may be better for you. Or just do it by analogy with the one described, but the files for both up and down.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question