I have an application deployed as a PEAR package. It uses at database,
which I maintain through MDB2_Schema.
The following will do the trick, when I want to upgrade the database
from an old version to a new version:
PHP Code:
$current_definition = $this->schema->getDefinitionFromDatabase();
if (PEAR::isError($current_definition)) {
die('current: ' . $current_definition->getMessage() .
$current_definition->getUserInfo());
}
$result = $this->schema->updateDatabase(
$this->new_definition_file,
$current_definition,
array('create' =>'0', 'name' =>$this->database)
);
if (PEAR::isError($result)) {
die($result->getUserInfo);
}
Now suppose I wanted to revert from 1.0.1 to 1.0.0 because I discoved
an error. However values has been entered in some of the new fields in
the database.
If I just run the code above all new fields would be deleted. Is the
best way to solve this situation to do as it is done on pearweb where
old versions is saved in the doc_root/sql directory and that is the
file used to do the comparisons?
--
Lars Olesen
Gratis backup
https://mozy.com/?code=9MYJPF