-
Notifications
You must be signed in to change notification settings - Fork 647
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
Fix conflicting annotations for multiple-database scenario #892
base: develop
Are you sure you want to change the base?
Fix conflicting annotations for multiple-database scenario #892
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our app also got affected, I had to temporarily disable other databases to be able to annotate correctly.
Given a Rails application with multiple databases, tables in two databases with the same table name, and corresponding models with different names, some files get annotated with the wrong table's schema. The issue is that some of the patterns include `%TABLE_NAME%`, which will be identical between the two tables, even though they have different model names. This fixes the issue by eliminating the use of the table name when the model is not connected to the primary database. Fixes ctran#891.
845978f
to
3ab4ab5
Compare
@afn sorry to hijack the thread a bit, but if you're interested I could get this added to my fork https://github.com/drwl/annotaterb. Since I'm still on the list of maintainers for this gem I get pinged about activity by Github every now and then. I would just need instructions on setting up a proof of concept Rails app with the case you're talking about (multiple databases + models with same table name). |
Thanks @drwl! I've pushed an example app to https://github.com/cygnuseducation/annotate-test-app. This test case doesn't actually end up incorrectly annotating the files, but it does incorrectly detect that there are relevant changes to the annotations:
See also the integration test in 385c293. Thanks! |
@afn would you mind if we continued discussions in drwl/annotaterb#135? |
Given a Rails application with multiple databases, tables in two databases with the same table name, and corresponding models with different names, some files get annotated with the wrong table's schema.
The issue is that some of the patterns include
%TABLE_NAME%
, which will be identical between the two tables, even though they have different model names.This fixes the issue by eliminating the use of the table name when the model is not connected to the primary database.
Fixes #891.