由于我没有创建用户表,因此无法进行迁移

时间:2019-09-02 15:23:45

标签: laravel database-migration

我正在尝试为方案的新表进行迁移,当我运行php artisan migration时,出现以下错误:

Migrating: 2014_10_12_000000_create_users_table
Illuminate\Database\QueryException  : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` bigint unsigned not null auto_increment primary key, `name` varchar(191) not null, `email` varchar(191) not null, `email_verified_at` timestamp null, `password` varchar(191) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

我没有创建该迁移,它是php artisan make:auth自动提供的,据我所知它已经在运行,因为users表已启动并正在运行,所以我不知道如何解决它。任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

尝试运行php artisan migrate:如果它不起作用,请重置,并给您错误的登录到phpmyadmin页面并手动将其删除。

,但是在再次运行php artisan迁移之前,请确保以下代码位于create_users_table迁移文件的底部:

 @return void

public function down()
{
    Schema::dropIfExists('users');
}

因此,当您运行php artisan migrate:刷新时,它会删除当前表并重新创建