【发布时间】:2020-11-05 02:54:16
【问题描述】:
当我使用 php artisan migrate 时,我会收到此消息。有人可以帮我弄这个吗?我在互联网上搜索,但没有找到任何对我有帮助的东西。 (我是 laravel 新手)
我的桌子:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSroomsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('srooms', function (Blueprint $table) {
$table->id();
$table->string('room_two');
$table->string('room_three');
$table->string('room_four');
$table->string('room_five');
$table->string('room_six');
$table->string('room_seven');
$table->string('room_eight');
$table->string('room_nine');
$table->string('room_ten');
$table->string('room_eleven');
$table->string('room_twelve');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('srooms');
}
}`
【问题讨论】:
-
尝试改变$table->id();到 $table->increments('id');
-
这可能是您的 .env 文件中的错误 MySQL 端口号。检查您的 .env 文件并确保端口号与 MySQL 使用的端口号匹配。
-
我试过了,但没有解决。我还使用了 $table->increments('id');而不是 $table->id();但我仍然遇到同样的错误。
标签: error-handling laravel-7 artisan-migrate