-
Notifications
You must be signed in to change notification settings - Fork 22k
Allow per-database schema format #53666
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
Conversation
601b968
to
41359a9
Compare
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'm a member of the triage team who has some familiarity with the database tasks and config code.
Currently the use of SCHEMA_FORMAT
is limited to the database tasks, and I think we'd prefer to keep it out of the config classes if possible. I've made specific comments in the code.
Please also be careful about changing the method signatures of public methods (or more specifically, public methods that aren't flagged as internal-only with # :nodoc:
). I've made a comment there as well.
activerecord/lib/active_record/database_configurations/hash_config.rb
Outdated
Show resolved
Hide resolved
41359a9
to
9486dda
Compare
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.
Thanks for the review and sorry this has taken me a little while to get back to. I've actioned all the points you've raised.
activerecord/lib/active_record/database_configurations/hash_config.rb
Outdated
Show resolved
Hide resolved
9486dda
to
8fa2802
Compare
345468d
to
16a5bdf
Compare
e2bd1b8
to
93275d8
Compare
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 have a failing test on the changelog but I can't figure out why sorry.
93275d8
to
804aca2
Compare
@tsvallender Can I ask you to please "resolve" all the threads you've addressed? I realized that I've been procrastinating another review because of the anticipated cognitive overhead of re-reading each thread to determine if something is still needed. (It may not be obvious, but as the reviewer, github will not allow me to resolve the threads myself.) Thanks, and sorry for my delay in responding. |
Apologies, I've been used to a workflow where the other person resolves them when they confirm they're happy - the permissions must be different on that repo. I've resolved them all now. Thanks for your time reviewing! 🙏 |
activerecord/lib/active_record/database_configurations/hash_config.rb
Outdated
Show resolved
Hide resolved
989d051
to
1c1fea3
Compare
5955ba7
to
822871f
Compare
379f519
to
0c961d4
Compare
Checks the database configuration for a schema_format key, allowing applications with multilpe databases to set schema format individually for each one. Falls back to standard configuration attribute when this is not present.
0c961d4
to
3081fc9
Compare
Just rebased this and all checks are now passing, confirming the previous BuildKit issue was unrelated 👍 |
* main: Cleanup #53666 Allow per-database schema format in database config Move test helpers into test_helpers (#54688) Add `except_on:` option for validation callbacks Fix capture view helper to pass keyword arguments Stop generating bundler binstub: Fix channel generator import statement: Optimize `String#parameterize` Add anchor links to FormOptionsHelper [ci skip] Fix creating fsm visualizer with lazy routes
Considering how we go forward in rails#53666, this has been an oversight when introducing the `SCHEMA_FORMAT` environment variable.
Considering how we go forward in rails#53666, this has been an oversight when introducing the `SCHEMA_FORMAT` environment variable.
Motivation / Background
This PR allows applications with multiple databases to set a
schema_format
independently for each one.I've personally found a desire for this when converting a legacy application to use the standard Rails methods one piece at a time, but it would also be useful when there is a need to move a database to use
structure.sql
(for some specific functionality) but no desire to do this for all databases.Detail
The
schema_format
can now be set toruby
orsql
in the database configuration. If this does not exist, there is no change in behaviour and the application-wide configuration is used, or the environment variable if present and appropriate.Additional information
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]