これは私の移行ファイルです
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique();
$table->text('payload');
$table->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('sessions');
}
}
私が走ったときに作成されました
php artisan session:table
プロジェクトは問題なく書き込みおよび読み取りを行っているため、データベース接続は正しく構成されています。
プロジェクトのルートディレクトリから実行します
php artisan migrate
そして、次のエラーメッセージが表示されます
[Illuminate\Database\QueryException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'sessions' already exists (SQL: create table `sessions` (`id` varchar(255) not null, `payload` text not null, `last_activity` int not null) default character set utf8 collate utf8_unicode_ci)
[PDOException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'sessions' already exists
私は実行する必要があることを知っています
composer dump-autoload
しかし、私はそれを使って試してみましたが、同じ結果が得られました。$table 引数の前にブループリント タイプも試しました。
プロジェクトを実行したときに使用するデータベースとは異なるデータベースにアクセスしているかのように動作します