Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails solid_queue:install:migrations is not a valid command #419

Closed
Juksefantomet opened this issue Nov 19, 2024 · 11 comments
Closed

rails solid_queue:install:migrations is not a valid command #419

Juksefantomet opened this issue Nov 19, 2024 · 11 comments

Comments

@Juksefantomet
Copy link

Running rails solid_queue:install:migrations is not a valid command.

juksefantomet@UBERJUKSE:~/git_projects/staff_pulse_check$ rails solid_queue:install:migrations
Unrecognized command "solid_queue:install:migrations" (Rails::Command::UnrecognizedCommandError)
Did you mean?  solid_queue:install
juksefantomet@UBERJUKSE:~/git_projects/staff_pulse_check$ rails solid_queue:install
   identical  config/queue.yml
   identical  config/recurring.yml
    conflict  db/queue_schema.rb
Overwrite /home/juksefantomet/git_projects/staff_pulse_check/db/queue_schema.rb? (enter "h" for help) [Ynaqdhm] y
       force  db/queue_schema.rb
   identical  bin/jobs
        gsub  config/environments/production.rb

Running rails solid_queue:install works - BUT - if ran repeatedly it adds more entries to config/environments/production.rb

juksefantomet@UBERJUKSE:~/git_projects/staff_pulse_check$ cat config/environments/production.rb

.....previous
 # Don't log any deprecations.
  config.active_support.report_deprecations = false

  # Replace the default in-process memory cache store with a durable alternative.
  config.cache_store = :solid_cache_store

  # Replace the default in-process and non-durable queuing backend for Active Job.
  config.active_job.queue_adapter = :solid_queue
  config.solid_queue.connects_to = { database: { writing: :queue } }

  config.solid_queue.connects_to = { database: { writing: :queue } }

  config.solid_queue.connects_to = { database: { writing: :queue } }

  config.solid_queue.connects_to = { database: { writing: :queue } }


  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  # config.action_mailer.raise_delivery_errors = false
....continues

so you'll end up with multiple declarations 😄

rails: 8.0.0
ruby: 3.3.6
ubuntu/WSL

@n-studio
Copy link

Similar to this issue, the solid_queue:install command will generate a schema file but no migration files. Running bin/rails db:migrate will override the schema file and empty it as there is no migration files.

@rosa
Copy link
Member

rosa commented Nov 27, 2024

Running rails solid_queue:install:migrations is not a valid command.

@Juksefantomet, right. That's on purpose, it's not a provided command.

if ran repeatedly it adds more entries to config/environments/production.rb

Why would you run it repeatedly?

the solid_queue:install command will generate a schema file but no migration files

@n-studio that's on purpose.

@n-studio
Copy link

@rosa But then running bin/rails db:migrate will empty the schema file. Is it on purpose too? I'm confused.

@rosa
Copy link
Member

rosa commented Nov 27, 2024

@Juksefantomet
Copy link
Author

Running rails solid_queue:install:migrations is not a valid command.

@Juksefantomet, right. That's on purpose, it's not a provided command.

if ran repeatedly it adds more entries to config/environments/production.rb

Why would you run it repeatedly?

the solid_queue:install command will generate a schema file but no migration files

@n-studio that's on purpose.

My bad then, i was not catching on that that install:migrations was removed:

https://github.com/rails/solid_queue/blob/main/UPGRADING.md

As per the above link the upgrade says the binstub was introduced, but the old previous one was not removed 😄

In regards to the duplicate config entry:

A few cases can have individuals running a command repeatedly.

When a member of our team pulls the project for the first time. They might have issues with their setup, not necessarily related to that gem and/or initialization specifically.

But they decide to re-run steps as a part of their troubleshooting.

This can also occur when you remove a gem and you decide to re initialize the setup.

It's not expected to manually revert a config but expected to the config to be detected and not appended in duplicate entries.

Additionally the generator specifically states "gsub" in the production.rb file. I would assume it replaces if present and append if not present.

@rosa
Copy link
Member

rosa commented Nov 28, 2024

As per the above link the upgrade says the binstub was introduced, but the old previous one was not removed 😄

What do you mean? 🤔 I'm not sure I follow. The binstub there refers to bin/jobs.

About the duplicate config entry, there's a PR to make it idempotent: #349. I'll finish that and will merge it soon, I'm just not clear yet about the approach.

@Juksefantomet
Copy link
Author

Juksefantomet commented Nov 28, 2024

As per the above link the upgrade says the binstub was introduced, but the old previous one was not removed 😄

What do you mean? 🤔 I'm not sure I follow. The binstub there refers to bin/jobs.

About the duplicate config entry, there's a PR to make it idempotent: #349. I'll finish that and will merge it soon, I'm just not clear yet about the approach.

Without overcomplicating this too much 😄

The overall results when I was googling / researching setting up solid_queue which led me to the migrations line for initialization (which is meant for another purpose not initialization and/or first setup?).

As pr. the link provided that was where I ended up when i was trying to get everything to work.

When trying to setup things one ends up removing / resetting so it was a result of multiple attempts leading to both scenarios.

@rosa
Copy link
Member

rosa commented Dec 5, 2024

I fixed the duplication when running the installer multiple times in #439, and included it in the last version, 1.1.0, so I'm closing this one.

@rosa rosa closed this as completed Dec 5, 2024
@jaspervanbrian
Copy link

Running rails solid_queue:install:migrations is not a valid command.

@Juksefantomet, right. That's on purpose, it's not a provided command.

if ran repeatedly it adds more entries to config/environments/production.rb

Why would you run it repeatedly?

the solid_queue:install command will generate a schema file but no migration files

@n-studio that's on purpose.

What command should we run to generate our migration files then?

@rosa
Copy link
Member

rosa commented Dec 28, 2024

@jaspervanbrian, you don't need to generate migration files for Solid Queue, the schema file that gets copied when installing it is enough to create the DB and the tables.

@jaspervanbrian
Copy link

@jaspervanbrian, you don't need to generate migration files for Solid Queue, the schema file that gets copied when installing it is enough to create the DB and the tables.

@rosa, I guess issue rails/rails#52829 still persists. I'm running two db (postgres as my main and sqlite as my secondary for caching), and schema files are not being generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants