-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Add config.active_record.dump_schemas. #19347
Conversation
@senny @jimmykarily Here is a first pass. Feedback appreciated. :) |
# Specifies which database schemas to dump when calling db:structure:dump. | ||
# If :schema_search_path, it will dumps any schemas listed in schema_search_path. | ||
# Use :all to always dumps all schemas regardless of the schema_search_path. | ||
# A string of comma separated schemas can also be used to pass a custom list of schemas. |
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.
The docs should mention the default value.
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.
I was trying to model it after the documentation for schema_format (above) which doesn't specify the default in the doc. Should I change both?
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.
Let's focus on this change for now. If you have time, you can update the other in a separate PR.
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.
Done.
@rywall looking good. Do you think you could add test-cases for this new functionality? |
👍 |
2f3108b
to
8e10e5d
Compare
@senny I've added some tests. Anything else? |
end | ||
|
||
def test_structure_dump_with_dump_schemas_string | ||
ActiveRecord::Base.dump_schemas = 'test' |
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.
let's use an example with two schemas as well.
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.
Done.
@rywall I added a couple comments. Thank you for your work on this 💛 |
Fixes db:structure:dump when using schema_search_path and PostgreSQL extensions. Closes rails#17157.
8e10e5d
to
7ab36f4
Compare
I've refactored the tests to avoid side effects. I think I've addressed all you other comments as well. Thanks for your feedback. The pull request is much better for it. 👍 |
Add config.active_record.dump_schemas.
@rywall awesome! Thank you for your work 💛 |
Thanks! |
Thanks, @rywall! If anyone else stumbles upon this and would find this functionality useful in Rails 3 or Rails 4, I created a gem to backport this functionality to those versions of Rails: https://github.com/GUI/activerecord-postgres-dump-schemas |
❤️ @GUI. |
Thanks for this. Any plans to support pg_dump's In some cases, it might be more convenient to have a "black list", not a "white" one. |
For anyone looking for a way to dump extensions along with a subset of schemas, or otherwise needing extra control over
|
Fixes db:structure:dump when using schema_search_path and PostgreSQL extensions.
Closes #17157.