From ef8d752ad2eda302591e0f211bbebdf5ef64e93f Mon Sep 17 00:00:00 2001 From: igor-chepurnoi Date: Fri, 11 Nov 2016 10:48:29 +0200 Subject: [PATCH] fix issue 'table already exists' for windows --- .../m161109_104201_rename_setting_table.php | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/migrations/m161109_104201_rename_setting_table.php b/migrations/m161109_104201_rename_setting_table.php index 983d251..3384ea6 100644 --- a/migrations/m161109_104201_rename_setting_table.php +++ b/migrations/m161109_104201_rename_setting_table.php @@ -6,22 +6,15 @@ class m161109_104201_rename_setting_table extends Migration { public function up() { - $this->renameTable('{{%Setting}}', '{{%setting}}'); + if (Yii::$app->db->schema->getTableSchema('setting') === null) { + $this->renameTable('{{%Setting}}', '{{%setting}}'); + } } public function down() { - $this->renameTable('{{%setting}}', '{{%Setting}}'); + if (Yii::$app->db->schema->getTableSchema('Setting') === null) { + $this->renameTable('{{%setting}}', '{{%Setting}}'); + } } - - /* - // Use safeUp/safeDown to run migration code within a transaction - public function safeUp() - { - } - - public function safeDown() - { - } - */ -} +} \ No newline at end of file