【发布时间】:2020-02-04 01:12:04
【问题描述】:
在复制此项目之前一切正常,但在将此项目复制到另一台笔记本电脑后,我无法迁移数据库错误
Illuminate\Database\QueryException : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'discussionforum.channels' doesn't exist (SQL: select * from `channels`)
at /opt/lampp/htdocs/discussionforum/vendor/laravel/framework/src/Illuminate/Database/Connection.php:665
661| // If an exception occurs when attempting to run a query, we'll format the error
662| // message to include the bindings with SQL, which will make this exception a
663| // lot more helpful to the developer instead of just the database's errors.
664| catch (Exception $e) {
> 665| throw new QueryException(
666| $query, $this->prepareBindings($bindings), $e
667| );
668| }
669|
Exception trace:
1 Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(App\Providers\AppServiceProvider))
[internal]:0
2 PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'discussionforum.channels' doesn't exist")
/opt/lampp/htdocs/discussionforum/vendor/laravel/framework/src/Illuminate/Database/Connection.php:327
Please use the argument -v to see more details.
【问题讨论】:
-
尝试使用“php artisan migrate:fresh”并说出结果
-
您确定您的表迁移的日期是按照您希望配置的顺序(从最旧到最新)进行的吗?听起来您可能在创建表之前进行了修改(添加、删除或更改字段或索引)。将任何索引拆分为在创建所有表后运行的自己的迁移也可能会有所帮助。
-
用这么少的信息很难看出错误的位置。尝试添加相关的迁移类及其名称。看来您执行它们的顺序错误。
-
您应该检查
AppServiceProvider或其他在迁移之前启动的提供程序,如果您在提供程序中使用某些表或模型,当该表不存在时您无法使用迁移。
标签: laravel