diff --git a/CHANGELOG b/CHANGELOG index f85860a92..7dbccdb9f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/framework/cli/commands/MigrateCommand.php b/framework/cli/commands/MigrateCommand.php index 14b5b3ad3..312cb7ed8 100644 --- a/framework/cli/commands/MigrateCommand.php +++ b/framework/cli/commands/MigrateCommand.php @@ -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();