首页 > 解决方案 > 迁移期间未找到基表或视图

问题描述

我正在宅基地运行退出 laravel 项目。运行时php artisan migrate得到错误。

这是完整的错误。

在 Connection.php 第 664 行:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'forum.chanel' doesn't exist (SQL: select * from `chanel`)  


In Connection.php line 326:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'forum.chanel' doesn't exist 

这是我的香奈儿表

public function up()
    {
        Schema::create('chanels', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->string('slug');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('chanels');
    }

为什么我收到错误,我该如何解决这个错误?

运行 composer update 时出现错误

在此处输入图像描述

标签: laravelartisan-migrate

解决方案


看起来您的模型名称和表名称不同步,在此之前从数据库中删除所有表可能是问题或迁移表运行中的迁移composer dumpa安排

尝试通过指定 $table 名称来更新您的模型,

class Chanel extends Model{
    public $table = "chanels";

推荐阅读