samsondav / rihanna

Rihanna is a high performance postgres-backed job queue for Elixir
MIT License
439 stars 49 forks source link

Upgrade checks fail when database has multiple schemas & job tables #99

Closed rubysolo closed 3 years ago

rubysolo commented 4 years ago

We are running into issues with the upgrade checks in a multiple-schema database (each schema has its own jobs table). Here's an example:

  # ** (CaseClauseError) no case clause matching: {:ok, %Postgrex.Result{
  # columns: ["indexdef"], command: :select, connection_id: 29014, messages: [], num_rows: 4,
  # rows: [["CREATE INDEX rihanna_jobs_locking_index ON public.rihanna_jobs USING btree (priority, due_at NULLS FIRST, enqueued_at, id)"],
  #        ["CREATE INDEX rihanna_jobs_locking_index ON \"feature-one\".rihanna_jobs USING btree (priority, due_at NULLS FIRST, enqueued_at, id)"],
  #        ["CREATE INDEX rihanna_jobs_locking_index ON \"feature-two\".rihanna_jobs USING btree (priority, due_at NULLS FIRST, enqueued_at, id)"],
  #        ["CREATE INDEX rihanna_jobs_locking_index ON \"feature-three\".rihanna_jobs USING btree (priority, due_at NULLS FIRST, enqueued_at, id)"]]}}
  #   (rihanna 2.2.0) lib/rihanna/migration.ex:271: Rihanna.Migration.check_upgrade_not_required!/1
  #   (rihanna 2.2.0) lib/rihanna/job_dispatcher.ex:31: Rihanna.JobDispatcher.handle_info/2
  #   (stdlib 3.13) gen_server.erl:680: :gen_server.try_dispatch/4
  #   (stdlib 3.13) gen_server.erl:756: :gen_server.handle_msg/6
  #   (stdlib 3.13) proc_lib.erl:226: :proc_lib.init_p_do_apply/3