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 6.0 - "Nothing to do" when running rake db:generate_trigger_migration #84

Open
Owumaro opened this issue Aug 28, 2019 · 5 comments

Comments

@Owumaro
Copy link

Owumaro commented Aug 28, 2019

When I run rake db:generate_trigger_migration for my Rails 6.0 app I get "Nothing to do" even if I added triggers to a model.

This is tied to this issue : rails/rails#37006

See https://github.com/ojab/hair_trigger/blob/rails-6/lib/hair_trigger.rb#L24
To get models, this gem runs

Rails.application.eager_load!
ActiveRecord::Base.descendants

However it is not enough in Rails 6.0, you have to run Zeitwerk::Loader.eager_load_all to load all models before running ActiveRecord::Base.descendants.

Not sure if this gem should adapt itself or wait for a fix in Rails.

@jainbasil
Copy link

I'm also facing the same issue using hair_trigger with Rails 6. Migrations are not getting generated.

@pedantic-git
Copy link

@jainbasil Me too. I have taken to going to the Rails console and issuing a variant of @Owumaro's note above:

Zeitwerk::Loader.eager_load_all
Rails.application.load_tasks
Rake::Task['db:generate_trigger_migration'].invoke

It would be great for this gem to get a fix so I can go back to just using the rake task!

@pedrofurtado
Copy link

Related to rails/rails#37006

@jenseng
Copy link
Owner

jenseng commented Jan 31, 2021

Is this still an issue? Seems like a fix may have been merged to rails 6 stable here: rails/rails@3285f3d

@pedantic-git
Copy link

@jenseng Confirmed I can now generate migrations with the rake task in Rails 6.0.3.5, so I think you're right it's been fixed upstream.

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

5 participants