diff --git a/database/migrations/2020_12_12_203153_migrate_admin_user.php b/database/migrations/2020_12_12_203153_migrate_admin_user.php index 47b606201b..10dbfdc554 100644 --- a/database/migrations/2020_12_12_203153_migrate_admin_user.php +++ b/database/migrations/2020_12_12_203153_migrate_admin_user.php @@ -1,8 +1,11 @@ username = Configs::get_value('username', ''); $user->password = Configs::get_value('password', ''); $user->save(); - // user will have a id which is NOT 0. - // we want this user to have an ID of 0 as it is the ADMIN ID. + // User will have an ID which is NOT 0. + // We want this user to have an ID of 0 as it is the ADMIN ID. $user->id = 0; $user->save(); } @@ -28,14 +32,14 @@ public function up() * Reverse the migrations. * * @return void + * @throws InvalidArgumentException */ - public function down() + public function down(): void { if (Schema::hasTable('users')) { - $user = User::find(0); - if ($user != null) { - $user->delete(); - } + DB::table('users') + ->where('id', '=', 0) + ->delete(); } } }