わからないこと
PHPフレームワークlaravel入門の参考書を使いマイグレーションの処理、ターミナルにて「php artisan migrate」を行ったところエラーが発生、回答をお願いいたします。
エラー内容
terminal
1 Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1 table "people" already exists (SQL: create table "people" ("id" integer not null primary key autoincrement, "name" varchar not null, "email" varchar not null, "age" integer not null, "created_at" datetime null, "updated_at" datetime null)) 2 3 at /Users/takuma/Desktop/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:665 4 661| // If an exception occurs when attempting to run a query, we'll format the error 5 662| // message to include the bindings with SQL, which will make this exception a 6 663| // lot more helpful to the developer instead of just the database's errors. 7 664| catch (Exception $e) { 8 > 665| throw new QueryException( 9 666| $query, $this->prepareBindings($bindings), $e 10 667| ); 11 668| } 12 669| 13 14 Exception trace: 15 16 1 PDOException::("SQLSTATE[HY000]: General error: 1 table "people" already exists") 17 /Users/takuma/Desktop/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:453 18 19 2 PDO::prepare("create table "people" ("id" integer not null primary key autoincrement, "name" varchar not null, "email" varchar not null, "age" integer not null, "created_at" datetime null, "updated_at" datetime null)") 20 /Users/takuma/Desktop/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:453 21 22 Please use the argument -v to see more details.
マイグレーションファイル
php
1<?php 2 3use Illuminate\Database\Migrations\Migration; 4use Illuminate\Database\Schema\Blueprint; 5use Illuminate\Support\Facades\Schema; 6 7class CreatePeopleTable extends Migration 8{ 9 /** 10 * Run the migrations. 11 * 12 * @return void 13 */ 14 public function up() 15 { 16 Schema::create('people', function (Blueprint $table) { 17 $table->increments('id'); 18 $table->string('name'); 19 $table->string('mail'); 20 $table->integer('age'); 21 $table->timestamps(); 22 }); 23 } 24 25 /** 26 * Reverse the migrations. 27 * 28 * @return void 29 */ 30 public function down() 31 { 32 Schema::dropIfExists('people'); 33 } 34}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/12/20 02:14