mirror of
https://github.com/yiisoft/yii.git
synced 2026-02-20 01:21:22 +01:00
(Fixes issue 2717) Extracted MigrateCommand::createMigrationHistoryTable method from MigrateCommand::getMigrationHistory
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user