Skip to content

Commit ef8d752

Browse files
author
igor-chepurnoi
committed
fix issue 'table already exists' for windows
1 parent 4ab2c48 commit ef8d752

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

migrations/m161109_104201_rename_setting_table.php

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

1214
public function down()
1315
{
14-
$this->renameTable('{{%setting}}', '{{%Setting}}');
16+
if (Yii::$app->db->schema->getTableSchema('Setting') === null) {
17+
$this->renameTable('{{%setting}}', '{{%Setting}}');
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)