Skip to content

migration path not respected when setting up solid_queue on separate database? #144

Closed
@dianacamacho

Description

@dianacamacho

Firstly, thank you for all the work on solid queue so far!

Apologies if this is lack of understanding and user-error on my part, but when the docs mention supporting solid queue on a different database than the main app (via connects_to), does that mean that the install/migration commands should automatically pick up on the settings I've defined in my app's config/database.yml for the given connects_to database key, or do I still need to manually tell solid queue which one to use when running those?

Currently, with the config and database.yml settings listed below for a separate :solid_queue db, when I run bin/rails generate solid_queue:install or bin/rails solid_queue:install:migrations, the migration files for the SolidQueue tables are copied to the db/migrate folder, resulting in the tables getting added to the :primary db instead of the :solid_queue one. However, I would have expected the install to copy them to db/solid_queue_migrate, to match the migrations_paths defined in database.yml for the solid_queue db)

# config/application.rb

config.active_job.queue_adapter = :solid_queue
config.solid_queue.connects_to = { database: { writing: :solid_queue, reading: :solid_queue } }
# config/database.yml

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

solid_queue: &solid_queue
  <<: *default
  migrations_paths: db/solid_queue_migrate

development:
  primary:
    <<: *default
    database: queue_demo_development
  solid_queue:
    <<: *solid_queue
    database: queue_demo_solid_queue_development

test:
  primary:
    <<: *default
    database: queue_demo_test

production:
  primary:
    <<: *default
  solid_queue:
    <<: *solid_queue
    url: <%= ENV["SOLID_QUEUE_DATABASE_URL"] %>

If I manually pass in the DATABASE as an arg to the migration command (bin/rails solid_queue:install:migrations DATABASE=solid_queue), then things do work as expected, with files copied to db/solid_queue_migrate and added to the solid_queue db). If this is how it's meant to work, maybe that can be made a little clearer in the docs. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions