Laravel 5.4 php artisan migrate prompt table already exists
我想大声告诉你
我想大声告诉你 2017-05-16 16:47:03
0
2
464

Execute when the database does not have any tables

php artisan migrate

After execution, there will only be two tables in the database: migrations, users

Execute again

php artisan migrate

There will be no new additions to the database. Solve.

我想大声告诉你
我想大声告诉你

reply all(2)
给我你的怀抱


The length of the index exceeds mysql的限制,在migratebefore setting

$table->string('email' , 32)->index();
$table->string('token' , 128)->index();

or smaller...

大家讲道理

This is because 5.4 uses the utf8mb4 character set by default, in MySQL / MariaDB.

https://laravel.com/docs/5.4/migrations#indexes

Just install the sample modifications in the documentation.

In AppServiceProvider.php, boot method, call Schema::defaultStringLength method


// AppServiceProvider.php


use Illuminate\Support\Facades\Schema;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    Schema::defaultStringLength(191);
}

By the way, you can also enable the database's innodb_large_prefix configuration

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template