前提
Laravelの練習のために基本的な機能を持つデータ入力システムを作成しています。
「php artisan migrate」によってmigrateを行いましたが、エラーメッセージが出てしまうため、解決したいです。
実現したいこと
マイグレーションファイルの生成を行いたいです。
発生している問題・エラーメッセージ
※コマンドプロンプトで「php artisan migrate」を行った時のエラー内容です。
cmd
1 INFO Running migrations. 2 2022_11_07_030830_create_people .......................................................................... 64ms FAIL 3 Illuminate\Database\QueryException 4 SQLSTATE[HY000]: General error: 1 table "people" already exists (SQL: create table "people" ("id" integer not null primary key autoincrement, "id" integer not null primary key autoincrement, "name" varchar not null, "mail" varchar not null, "memo" varchar not null, "age" integer not null, "created_at" datetime, "updated_at" datetime)) 5 at C:\Users\murai\Documents\Laravelapp\vendor\laravel\framework\src\Illuminate\Database\Connection.php:760 6 756▕ // If an exception occurs when attempting to run a query, we'll format the error 7 757▕ // message to include the bindings with SQL, which will make this exception a 8 758▕ // lot more helpful to the developer instead of just the database's errors. 9 759▕ catch (Exception $e) { 10 ➜ 760▕ throw new QueryException( 11 761▕ $query, $this->prepareBindings($bindings), $e 12 762▕ ); 13 763▕ } 14 764▕ } 15 1 C:\Users\murai\Documents\Laravelapp\vendor\laravel\framework\src\Illuminate\Database\Connection.php:539 16 PDOException::("SQLSTATE[HY000]: General error: 1 table "people" already exists") 17 2 C:\Users\murai\Documents\Laravelapp\vendor\laravel\framework\src\Illuminate\Database\Connection.php:539 18 PDO::prepare("create table "people" ("id" integer not null primary key autoincrement, "id" integer not null primary key autoincrement, "name" varchar not null, "mail" varchar not null, "memo" varchar not null, "age" integer not null, "created_at" datetime, "updated_at" datetime)")
関連ファイルのソースコード
C:\Users\murai\Documents\Laravelapp\database\migrations
2022_11_07_030830_create_people.php
1<?php 2 3use Illuminate\Database\Migrations\Migration; 4use Illuminate\Database\Schema\Blueprint; 5use Illuminate\Support\Facades\Schema; 6 7return new class 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->id(); 18 19 $table->increments('id'); 20 $table->string('name'); 21 $table->string('mail'); 22 $table->string('memo'); 23 $table->integer('age'); 24 25 $table->timestamps(); 26 }); 27 } 28 29 /** 30 * Reverse the migrations. 31 * 32 * @return void 33 */ 34 public function down() 35 { 36 Schema::dropIfExists('people'); 37 } 38};
補足情報(FW/ツールのバージョンなど)
Laravel Framework 9.38.0