Closed apoorvpal01 closed 6 months ago
Hi @apoorvpal01,
Upgrade sequentially to Laravel 11
Did you upgrade from Laravel 7 to Laravel 11 just now or have you been running Laravel 10 for a while?
Can you switch back to the mysql
driver temporarily and test if the job works?
Hi @staudenmeir
I have been running on Laravel 10 for the past year without any issues, with the same config (except the DB driver change)
I switched back to the mysql driver on Laravel 11 and it worked fine. The problem occurs only on the mariadb
driver.
cc @hafezdivandari
@apoorvpal01 It's maybe related to strict mode, can you try mariadb
driver with strict => false
?
@hafezdivandari You're right. Disabling the strict mode fixed it. If this is the default requirement for queues, is it in the docs somewhere? Did I miss it? If not, maybe I could add a PR for this to be included in the docs for jobs.
@apoorvpal01 actually it's not about strict mode. The problem is that you're using an incompatible jobs
table structure, the available_at
column is not a timestamp
but unsignedInteger
(even in Laravel 7).
Laravel 7: https://github.com/laravel/framework/blob/7.x/src/Illuminate/Queue/Console/stubs/jobs.stub#L21-L23
Laravel 11: https://github.com/laravel/framework/blob/11.x/src/Illuminate/Queue/Console/stubs/jobs.stub#L19-L21
(The disabled strict mode just hid the error from you all this time.)
As @hafezdivandari said, it seems like Laravel has always being using integer
columns for this table and therefore tries to insert a UNIX timestamp (instead of a datetime
string).
Oh, thanks for the clarification. I am not sure how I got this schema on the database then. I'll check that out. Sorry for the trouble, and thanks for your help!
Laravel Version
11.0.5
PHP Version
8.3.3
Database Driver & Version
MariaDB 10.11.2 on Ubuntu 22.04 LTS with the MariaDB driver
Description
SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '1710393058' for column
laravel_test.
jobs.
available_atat row 1
I get the error mentioned above when running jobs on the PHP 8.3.3. The database I use has not been changed from the one migrated via Laravel 7 with the MySQL driver.
Steps To Reproduce
mariadb
driver.database
as theQUEUE_DRIVER
.