Skip to content

Commit 056dc46

Browse files
author
igor-chepurnoi
committed
fix issue 'table already exists' for windows
1 parent 052fc7f commit 056dc46

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

migrations/m161109_092304_rename_comment_table.php

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

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