DavidBirkin's avatar

Base Table Not Found "Jobs"

I have migrated a jobs table and the failed Jobs table correctly. If I enter the mysql client from the servers terminal, I can find the jobs table no problem, however, the laravel app I am running is not finding the jobs tables

Error: laravel.log production.ERROR: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blueridge_prod.jobs' doesn't exist (SQL: select * from `jobs` where `queue` = default and ((`reserved_at` is null and `available_at` <= 1682185647) or (`reserved_at` <= 1682185557)) order by `id` asc limit 1 FOR UPDATE SKIP LOCKED) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blueridge_prod.jobs' doesn't exist (SQL: select * from `jobs` where `queue` = default and ((`reserved_at` is null and `available_at` <= 1682185647) or (`reserved_at` <= 1682185557)) order by `id` asc limit 1 FOR UPDATE SKIP LOCKED) at /home/forge/blueridgevalor.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:759)

I have restarted the server, nginx, mysql, triple and quadruple checked the environment file. I have used cache:clear and cache:config respectively I have used route:clear and route:cache also.

I dropped the tables jobs and failed jobs and remade the migrations using queue:table and queue:failed-table and this did not work.

I have also restarted all services, remade queue worker in Forge, Remade the Scheduler in Forge

All of this and the issue is still persistant.

Am I missing something obvious?

0 likes
3 replies
DavidBirkin's avatar

Unfortunately, @laryai did not manage to solve this one. I followed all steps to no avail. I am hoping the community can help me out a little more here?

To add, these tables are completely accessible within the application itself, however, it's only when the queue worker is running schedule:run do these errors happen. The user running these commands are forge.

Could this be a perrmissions issue with forge user?

webservices-ca@outloook.com's avatar

Had a similar issue on a local VM that I had migrated to a new host (and .env file). I assumed php artisan queue:table would do it but it did not. I changed my QUEUE_CONNECTION from =database to =redis and things went back to normal.

I played around to see if the database connection would work just in case I wanted to use it. For some reason it didnt [until I ran php artisan migrate]. It's supposed to Create a migration for the queue jobs database table. Once I ran the migration everything was good when I set my .env with QUEUE_CONNECTION=database

My issue was that jobs needed to be created and processed when users log in. Telescope would produce the similar error messages:

QLSTATE[42P01]: Undefined table: 7 ERROR:  relation "jobs" does not exist\nLINE 1: insert into "jobs" ("queue",
1 like

Please or to participate in this conversation.