首页 > 解决方案 > Illuminate \ Database \ QueryException (42P01) SQLSTATE[42P01]: Undefined table: 7 ERROR: relationship "suggesteds" does not exist LINE 1

问题描述

我试图使用此处的代码在 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 并且没有它的错误之前。任何帮助将不胜感激。

标签: laravelpostgresql

解决方案


请用:

php artisan migrate:refresh

推荐阅读