-
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
Forces a DB connection to be established when running assets:precompile
#222
Comments
Hi there, I haven't done rails in a long time, but wouldn't setting bundle dependency to not autoload solve your issue? |
Excellent thought! Briefly looked into this:
I could try and restructure the gem loading (e.g. use autoload if What do you think? |
Thanks for the research so far! It does seems like restructure could be beneficial. But in the end of the day, I'm happy to follow your recommendation. |
I recently ran up on this issue as well and was able to work around this with
I believe the railtie require needs to happen before initializers to make sure it picks up the tasks properly, but in general, we want to delay loading this gem until active record itself loads since currently loading the gem forces ActiveRecord to load which was causing some surprises configuring ActiveRecord. For what its worth, I'm a fan of #221 which will let us just rely on this being required automatically. |
It looks like merely adding
data_migrate
to theGemfile
will force a database connection to be established duringassets:clobber
orassets:precompile
tasks.This is highly undesirable for Docker builds, as we have no database available unless we resort to nulldb or temporary sqlite connections during container builds.
This happens with
data_migrate 8.1.1
andrails 7.0.3.1
, but there might be other versions affected.There is a small rails app at https://github.com/foxondo/data-migrate-bug to showcase the problem. Please find further details in the README there.
We've opened #221 as a proposed fix for the issue, but there might be other ways to fix this.
The text was updated successfully, but these errors were encountered: