From 11bdf0ede62806182bc1ceaa65f8f141a851c812 Mon Sep 17 00:00:00 2001 From: forecho Date: Fri, 14 Feb 2020 22:08:21 +0800 Subject: [PATCH] fix: migrate file --- src/migrations/m200214_121740_update_h_log_table.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/migrations/m200214_121740_update_h_log_table.php b/src/migrations/m200214_121740_update_h_log_table.php index 36dd9a0..a84f612 100644 --- a/src/migrations/m200214_121740_update_h_log_table.php +++ b/src/migrations/m200214_121740_update_h_log_table.php @@ -15,7 +15,7 @@ public function safeUp() $this->addColumn("{{%h_log}}", 'fk', $this->string(100)->comment('外键')->defaultValue('')->after('h_log_template_id') ); - $this->alterColumn("{{%h_log}}", 'fk', + $this->alterColumn("{{%h_log}}", 'username', $this->string(100)->defaultValue(null)->comment('用户名') ); $this->createIndex('fk_h_log_template_id_fk', '{{%h_log}}', ['h_log_template_id', 'fk']); @@ -27,10 +27,10 @@ public function safeUp() public function safeDown() { echo "m200214_121740_update_h_log_table cannot be reverted.\n"; - $this->alterColumn("{{%h_log}}", 'fk', + $this->alterColumn("{{%h_log}}", 'username', $this->string()->defaultValue(null)->comment('用户名') ); - $this->dropColumn('fk_h_log_template_id_fk', '{{%h_log}}'); + $this->dropIndex('fk_h_log_template_id_fk', '{{%h_log}}'); $this->dropColumn("{{%h_log}}", 'fk'); return true; }