简体   繁体   English

运行“php artisan migrate”命令时如何修复“表不存在”错误?

[英]How to fix the “Table doesn't exist” error error when running 'php artisan migrate' command?

I have a project on which I need to run php artisan migrate .我有一个项目需要运行php artisan migrate It should be easy but I am getting an error:这应该很容易,但我收到一个错误:

php artisan migrate php 工匠迁移

Illuminate\Database\QueryException照亮\数据库\查询异常

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'skz.master_courses' doesn't exist (SQL: select * from master_courses where date_from > 2021-06-01 and master_courses . deleted_at is null order by date_from asc limit 1) SQLSTATE [42S02]:未找到基表或视图:1146 表 'skz.master_courses' 不存在(SQL:select * from master_courses where date_from > 2021-06-01 and master_courses deleted_atdate_from的限制日期)

I don't understand where the select command comes from.我不明白 select 命令来自哪里。 Does anybody know where is it from?有谁知道它来自哪里?

The error usually throw when database doesn't exist in mysql.当 mysql 中不存在数据库时,通常会抛出该错误。

But in your case, database exists in mysql server.So you it look like your application executing select query in any one of the service provider boot() method但是在您的情况下,数据库存在于 mysql 服务器中。因此,您的应用程序看起来像是在任何一种服务提供商boot()方法中执行 select 查询

public function boot()
{
          
}

So you might need to stop query execution till migration completes.因此,您可能需要停止查询执行,直到迁移完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM