Skip to content

Commit

Permalink
fix: migrate file
Browse files Browse the repository at this point in the history
  • Loading branch information
forecho committed Feb 14, 2020
1 parent c8e106b commit 11bdf0e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/migrations/m200214_121740_update_h_log_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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;
}
Expand Down

0 comments on commit 11bdf0e

Please sign in to comment.