Laravel Illumb\Database\QueryException(42P01)SQLSTATE[42P01]:未定义的表:7错误:关系;“建议”;不存在第1行
我试图用这里的代码在laravel中创建一个迁移。但不幸的是,它弹出了一个错误,就像这里给出的一样 我使用PostgreSQL 9.2.24Laravel Illumb\Database\QueryException(42P01)SQLSTATE[42P01]:未定义的表:7错误:关系;“建议”;不存在第1行,laravel,postgresql,Laravel,Postgresql,我试图用这里的代码在laravel中创建一个迁移。但不幸的是,它弹出了一个错误,就像这里给出的一样 我使用PostgreSQL 9.2.24 <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateSuggestedsTable extends Migra
<?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');
}
}
从数据库手动删除建议的表(如果存在),然后再次运行迁移脚本
您还应检查此项请使用:
php artisan migrate:refresh
如果可以的话,试着删除整个数据库并重新进行迁移。这个答案可能会有所帮助-可能是端口错误,请重新检查您的postgres端口