(Fixes issue 2717) Extracted MigrateCommand::createMigrationHistoryTable method from MigrateCommand::getMigrationHistory

This commit is contained in:
alexander.makarow
2011-08-05 22:25:19 +00:00
parent 512380559d
commit a8f5b10c4b
2 changed files with 17 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ Version 1.1.9 work in progress
- Enh #2604: CArrayDataProvider::keyField can now be set to false to use keys from $rawData array instead of a named keyField (creocoder, Sam Dark)
- Enh #2637: Related table alias set dynamically in relational query is now available in the scopes of related model (creocoder, Sam Dark)
- Enh #2654: Enhanced CUrlManager::addRules() by allowing new rules to be inserted in front of the existing rules (Qiang)
- Enh #2717: Extracted MigrateCommand::createMigrationHistoryTable method from MigrateCommand::getMigrationHistory (Sam Dark)
- Enh: Documented CModule accessors with @property for better IDE autocomplete (Sam Dark)
- Enh: Added CWebUser->loginRequiredAjaxResponse - value to be returned for ajax calls in case the user session has expired (mdomba)

View File

@@ -425,16 +425,7 @@ class MigrateCommand extends CConsoleCommand
$db=$this->getDbConnection();
if($db->schema->getTable($this->migrationTable)===null)
{
echo 'Creating migration history table "'.$this->migrationTable.'"...';
$db->createCommand()->createTable($this->migrationTable, array(
'version'=>'string NOT NULL PRIMARY KEY',
'apply_time'=>'integer',
));
$db->createCommand()->insert($this->migrationTable, array(
'version'=>self::BASE_MIGRATION,
'apply_time'=>time(),
));
echo "done.\n";
$this->createMigrationHistoryTable();
}
return CHtml::listData($db->createCommand()
->select('version, apply_time')
@@ -444,6 +435,21 @@ class MigrateCommand extends CConsoleCommand
->queryAll(), 'version', 'apply_time');
}
protected function createMigrationHistoryTable()
{
$db=$this->getDbConnection();
echo 'Creating migration history table "'.$this->migrationTable.'"...';
$db->createCommand()->createTable($this->migrationTable,array(
'version'=>'string NOT NULL PRIMARY KEY',
'apply_time'=>'integer',
));
$db->createCommand()->insert($this->migrationTable,array(
'version'=>self::BASE_MIGRATION,
'apply_time'=>time(),
));
echo "done.\n";
}
protected function getNewMigrations()
{
$applied=array();