Search code examples
laraveldatabase-migrationlaravel-7artisan-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. It should be easy but I am getting an error:

php artisan migrate

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)

I don't understand where the select command comes from. Does anybody know where is it from?


Solution

  • The error usually throw when database doesn't exist in 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

    public function boot()
    {
              
    }
    

    So you might need to stop query execution till migration completes.