-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
ActiveRecord::SchemaDumper removes prefixes and suffixes when ignoring tables. #9015
Comments
Hmm, This is an interesting issue. It behaves this way because the schema.rb should not know about the prefix configuration. In this way it is easy to change the prefix/suffix configuration without need to dump the schema again. I guess we can change these two lines https://github.com/rails/rails/blob/master/activerecord/lib/active_record/schema_dumper.rb#L73-74 to take in consideration only the table name with suffix. Mind to open a pull request? |
Don't mind at all my friend. And changing those two lines was exactly what I had in mind. |
I guess the situation described is problematic because of a more basic reason: Fixing this would solve the ignoring-scenario as well, as stripped table-names are unique. PS For completeness, the following is part of the configuration as well right?: ActiveRecord::Base.table_name_prefix = 'my_prefix_' |
I think we need to understand the motivations and use cases behind For instance, I totally understand what @eval described above. Should the For my use case I think it should be Also, when using |
This issue has been automatically marked as stale because it has not been commented on for at least The resources of the Rails team are limited, and so we are asking for your help. If you can still reproduce this error on the Thank you for all your contributions. |
I tried to reproduce this on |
Since the issue rails#9015 was unexpected fixed by the PR rails#17697, this commit makes sure that the cases reported by the issue are tested.
I noticed this old ticket and did a bit of investigation.
If folks agree I suggest we merge in the test case and close this ticket... |
This was fixed in e23ec4c |
…test-for-prefix-and-ignore Test case for Issue #9015 - ignore_table and table_prefix at same time
When I have the following in my database:
and configure
ActiveRecord::SchemaDumper.ignore_tables = ["some_table"]
The SchemaDumper ends up ignoring both tables, because it removes prefixes and suffixes before comparing tables names with the elements in the supplied array.
The result is that I never get the chance to ignore just one or the other table.
The text was updated successfully, but these errors were encountered: