another approach to schema cleanup after DB migration

This commit is contained in:
alexander.makarow
2011-12-27 19:20:45 +00:00
parent da2c08c9b8
commit 3d8563fddf
4 changed files with 23 additions and 10 deletions

View File

@@ -103,6 +103,7 @@ class MigrateCommand extends CConsoleCommand
return;
}
}
$this->getDbConnection()->getSchema()->refreshAll();
echo "\nMigrated up successfully.\n";
}
}
@@ -136,6 +137,7 @@ class MigrateCommand extends CConsoleCommand
return;
}
}
$this->getDbConnection()->getSchema()->refreshAll();
echo "\nMigrated down successfully.\n";
}
}
@@ -177,6 +179,7 @@ class MigrateCommand extends CConsoleCommand
return;
}
}
$this->getDbConnection()->getSchema()->refreshAll();
echo "\nMigration redone successfully.\n";
}
}
@@ -214,7 +217,10 @@ class MigrateCommand extends CConsoleCommand
if($i===0)
echo "Already at '$originalVersion'. Nothing needs to be done.\n";
else
{
$this->actionDown(array($i));
$this->getDbConnection()->getSchema()->refreshAll();
}
return;
}
}
@@ -408,6 +414,9 @@ class MigrateCommand extends CConsoleCommand
return $migration;
}
/**
* @var CDbConnection
*/
private $_db;
protected function getDbConnection()
{