magento 1数据库迁移回滚[重复]

This question already has an answer here:

I am interested in studding magento migrations. I know how magento does migration from one module version to another. But I didn't find a "Rollback" function in each of migration files. As I see all magento module "install" scripts are simple php scenarios with code:

/** @var $installer Mage_Sales_Model_Entity_Setup */
$installer = $this;
$installer->startSetup();

// do some stuff

$installer->endSetup();

Or event simpler:

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */

$installer->getConnection()->addColumn($this->getTable('googlebase/types'), 'target_country', "varchar(2) not null default 'US'");

So, how magento knows what to do in case you need to change your version from 1.1.0 to 1.0.9, for example. And how can I rollback to any version that I need? Thanks!

</div>

Rollbacks are manual reversion to a pre-upgrade database version.

Always test the upgrade process on a development environment thoroughly to make sure that the upgrade will be successful, always back up the database before committing live and always have a standard set of tests to run after you do the upgrade.

Standard procedure for an upgrade is to duplicate your live database and upgrade on the duplicate.