【发布时间】:2021-09-21 19:47:23
【问题描述】:
我试图使用此处的代码在 laravel 中创建迁移。但不幸的是,它会弹出一个像这里给出的错误。
我使用 PostgreSQL 9.2.24
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSuggestedsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('suggesteds', function (Blueprint $table) {
$table->increments('id');
$table->integer('channel_id')->unsigned()->index();
$table->string('group')->nullable()->index(); // 'technology',
'lifestyle', etc.
$table->string('language')->default('en')->index();
$table->integer('z_index')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('suggesteds');
}
}
在我使用 MySQL 之前并没有它的错误。 任何帮助将不胜感激。
【问题讨论】:
-
如果可以,请尝试删除整个数据库并再次迁移
-
这个答案可能会有所帮助 - stackoverflow.com/questions/40891205/…
-
可能是端口错误,重新检查你的postgres端口
标签: laravel postgresql