Skip to content

Commit

Permalink
fixed migration if user admin already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey committed Feb 26, 2021
1 parent 495ded3 commit ac8c97d
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -14,7 +14,7 @@ public function safeUp()
{
$this->addColumn('{{%user}}', 'is_admin', $this->tinyInteger(1)->unsigned()->notNull()->defaultValue(0));

$this->insert('{{%user}}', [
$this->upsert('{{%user}}', [
'username' => 'admin',
'email' => 'admin@example.com',
'auth_key' => Yii::$app->security->generateRandomString(),
Expand All @@ -23,7 +23,7 @@ public function safeUp()
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
'is_admin' => 1,
]);
], false);
}

/**
Expand Down

0 comments on commit ac8c97d

Please sign in to comment.