Skip to content

Commit 0ab0f7b

Browse files
author
igor-chepurnoi
committed
fix issue 'table already exists' for windows
1 parent 507574c commit 0ab0f7b

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

migrations/m161109_105445_rename_cms_table.php

+7-14
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,15 @@ class m161109_105445_rename_cms_table extends Migration
66
{
77
public function up()
88
{
9-
$this->renameTable('{{%Cms}}', '{{%cms}}');
9+
if (Yii::$app->db->schema->getTableSchema('cms') === null) {
10+
$this->renameTable('{{%Cms}}', '{{%cms}}');
11+
}
1012
}
1113

1214
public function down()
1315
{
14-
$this->renameTable('{{%cms}}', '{{%Cms}}');
16+
if (Yii::$app->db->schema->getTableSchema('Cms') === null) {
17+
$this->renameTable('{{%cms}}', '{{%Cms}}');
18+
}
1519
}
16-
17-
/*
18-
// Use safeUp/safeDown to run migration code within a transaction
19-
public function safeUp()
20-
{
21-
}
22-
23-
public function safeDown()
24-
{
25-
}
26-
*/
27-
}
20+
}

0 commit comments

Comments
 (0)