-
Notifications
You must be signed in to change notification settings - Fork 56
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
Error when listing columns for model backed by different DB #149
Comments
Suggested changes will solve this issue, but this gem still do not have proper support for multiple databases, see #63. Please, do open a PR. |
Thanks for opening the issue, @owst! I'm working hard on adding support for multi-database systems, so expect an update soon. Would you be willing to test a release candidate? |
Sure thing @gregnavis, that sounds good - thanks! |
@gregnavis I would like to test a release candidate too, call me in! Btw, thanks for this gem 😃 |
Hi @gregnavis I just came across this issue again preventing us from upgrading |
@owst, actually, yes, I've made some progress, but it's not done yet. I released |
Hi @gregnavis - just following up on this again - any further progress since your last comment? |
@owst, some progress, but need to put more time into that. I'm preparing 1.15 right now and created a milestone for 2.0. Multi-database support should land in 2.0. |
@gregnavis is there a relatively simple workaround? |
We have a couple of models that are backed by a different DB to the majority of models in our app. A rough example is something like this:
It seems that a couple of places in
active_record_doctor
assume that all tables can be accessed from a connection to a single DB (ActiveRecord::Base.connection
); when the "different DB" table names are accessed, a "table missing" error is raised because the connection used is to the wrong DB.For example, this line:
active_record_doctor/lib/active_record_doctor/detectors/missing_non_null_constraint.rb
Line 35 in f3b8ba5
uses
connection
, which raises an error along the lines of:A possible fix might be to use
models.first.columns
instead ofconnection.columns(table)
so that the per-model connection is used?Similarly, this line has the same issue:
active_record_doctor/lib/active_record_doctor/detectors/base.rb
Line 218 in f3b8ba5
I'm happy to have a stab at a PR for this, but would like some guidance as to any thoughts or suggested approaches before I start. I expect the fix will be to not use
connection
without reference to a particularmodel
instance.Thanks!
The text was updated successfully, but these errors were encountered: