-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Migrations generator assumes migrations are in db/migrate #352
Comments
Also, slightly related: Lines 6 to 8 in a69de2e
I can't tell exactly where this comes from, but inside the migrations they create a model that inherits from ActiveRecord::Base to do a migration but we'd need ours to come from |
- Temporarily added a symlink from db/migrate => db/worker_jobs_migrate to work around bensheldon/good_job#352
* Rename migration back to default good_job name, used for migration detection * bin/rails g good_job:update - Temporarily added a symlink from db/migrate => db/worker_jobs_migrate to work around bensheldon/good_job#352 * Patch GoodJob migration to use correct base class
Oh! Both of these are unfortunate. I will see if there is a simple way to pass down the options flag. I have regrets not using the default Rails::Engine mechanism for generating database migrations (I only recently learned about that). And thank you for flagging the ideal base class in the migration; that's a quick fix. |
Released in |
Such a fast turnaround! Thank you! 🙌 😍 |
tl;dr
Would like
bin/rails g good_job:update
to allow us to specify a separate DB or separate migrations directory, like the--database
option inrails generate migration
Background
In our app, we have set up the good_jobs table in a separate database from our main application.
Per the ActiveRecord multiple databases guide, we use the
migrations_paths
config to put those migrations are indb/worker_jobs_migrate
instead of the normaldb/migrate
.When generating migrations, we use the
--database
CLI arg to specifyworker_jobs
so Rails knows to put things in the right spot, ex:However, GoodJob assumes migrations are in
db/migrate
:good_job/lib/generators/good_job/update_generator.rb
Line 26 in 236aea2
Problems
Since our migrations are in a different place, GoodJob is unable to detect migrations that have already happened to give us diffs
The text was updated successfully, but these errors were encountered: