Open rclimepoint opened 1 year ago
Thank you for the excellent report @rclimepoint!
Yes, I can see how that would be an issue. Hmm, this is a tough one - how to know if there are "more migrations to come". I guess maybe for this exact error I can make it give a precise error message with instructions of what to do.
Will have a look...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Will have a look at this one still. I think it isn't urgent, but a better error message would be nice.
It seems like the only reliable way to solve this might be to not attempt to enqueue the job during migrations at all. Instead you could add a step to the instructions to enqueue it after migrations, either in seeds or a rake task.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I will look at this...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Description
The Que scheduler migration calls
Que::Scheduler::VersionSupport.enqueue_a_job(Que::Scheduler::SchedulerJob)
when applying the first version of Que scheduler. This is not a problem if you run this migration after you have migrated Que, or if your database schema is already up-to-date and doesn't need to run all the previous migrations.However, when starting off with an empty database, the
db:migrate
will start migrating from the first version. Since this is an upgrade, the Que migration will be migrated last and this results in the Que scheduler migration failing due to the 'kwargs' column not existing in theque_jobs
table at this point.Versions
ruby version: 2.7.6 que version: 2.2 que-scheduler version: 4.4 postgres version: 14.5
Messages
An example below is if you have following migration files:
Caused by: PG::UndefinedColumn: ERROR: column "kwargs" of relation "que_jobs" does not exist LINE 1: ...e_jobs (queue, priority, run_at, job_class, args, kwargs, da...
Workaround
We've added a monkey patch to skip the job enqueue when doing a migration, and then re-enqueue the scheduler once we've migrated Que to the latest version: