规格:
描述:
C:/Users/user/code/blog/>php artisan migrate [Illuminate\Database\QueryException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table users (id int unsigned not null aut o_increment primary key, name varchar(255) not null, email varchar(255) not null, 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 engine = InnoDB R OW_FORMAT=DYNAMIC) [PDOException] SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
重现步骤:
C:/Users/user/code/blog/>laravel new website C:/Users/user/code/blog/>php artisan make:migration create_lists_table --create=lists C:/Users/user/code/blog/>php artisan migrate
问题
它创建用户表并给出错误,但不创建列表表
我通过更改我的create_users_table.php解决了自己的问题
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::dropIfExists('users'); Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('users'); } }