Error migrating in Laravel 5.5

0

when doing the migrations of the tables, in my project of laravel 5.5 . I get this error, clean and configure the cache, but the error remains, does anyone help me?

Thanks

In Connection.php line 664:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
  ady exists (SQL: create table 'users' ('id' int unsigned not null auto_incr
  ement primary key, 'name' varchar(255) not null, 'email' varchar(255) not n
  ull, 'password' varchar(255) not null, 'remember_token' varchar(100) null,
  'created_at' timestamp null, 'updated_at' timestamp null) default character
   set utf8mb4 collate utf8mb4_unicode_ci)


In Connection.php line 458:

  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre
  ady exist
    
asked by Appiweb 22.12.2017 в 17:00
source

1 answer

0

Try to drop the table in the migration file if it already exists before creating it:

class CreateUsersTable extends Migration
{
    public function up()
    {
        Schema::dropIfExists('users');
        Schema::create('users', function (Blueprint $table) {
            //todos los campos que quieras
        });
    }

    public function down()
    {
        Schema::dropIfExists('users');
    }
}
    
answered by 22.12.2017 в 19:07