laravel - 迁移期间未找到基表或视图
问题描述
我正在宅基地运行退出 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 时出现错误
解决方案
看起来您的模型名称和表名称不同步,在此之前从数据库中删除所有表可能是问题或迁移表运行中的迁移composer dumpa
安排
尝试通过指定 $table 名称来更新您的模型,
class Chanel extends Model{
public $table = "chanels";
推荐阅读
- javascript - React:如何显示默认对象并突出显示 li 粗体?
- python - 如何绘制我的数据框(python 和 pandas)
- json - 无法使用 JSON 呈现事件 FullCalendar
- javascript - 在 React for Google Analytics 中安装 Google Tag Manager 有困难
- ios - 如何在 iOS 10 的目标 c 中使用 uisearchbar?
- php - PHP 通过提交按钮导出数组,其中包含 CSV 的密钥
- halcon - 在 HALCON 中压印图像
- google-cloud-ml - Google Cloud ML Engine:其他 GCS 存储桶中的访问模型
- java - 如何为 java.time.LocalDateTime 自定义全局杰克逊反序列化器
- javascript - Moment 无法使用 webpack (typescript + babel)