-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Schema search path should not be included in schema.rb when a migration is executed. #325
Comments
Is it not reasonable to expect schema names to be consistent across environments? |
There are several use cases where the schema_search_path is what changes across the environments and the db stays the same, thats why activerecord does not include the search_path on the schema.rb.
So in reality, adding the schema name makes it inconsistent because it changes every time it runs /is generated on a different schema_search path. |
I agree with this approach since it directly aligns with ActiveRecord's approach. Additionally, many DBaaS providers use Schema or Database names as a way to uniquely identify databases and companies in their platform so you might not have control over either across your environments. |
This seems like it would be a breaking change given that the reason this exists in the first place was due to users taking the opposite approach. However, given that Rails now has native multiple database support, it may be worth revisiting. I haven't done anything personally with multi db support though. @calebthompson what do you think? |
many DBaaS providers use Schema or Database names as a way to uniquely
identify databases and companies
I haven’t run into this before. Can you share a docs example for using
schema names here? Heroku does database names for hobby-tier databases
but schemas are new to me.
On April 15, 2021, GitHub ***@***.***> wrote:
This seems like it would be a breaking change given that the reason
this exists in the first place was due to users taking the opposite
approach. However, given that Rails now has native multiple database
support, it may be worth revisiting. I haven't done anything
personally with multi db support though.
@calebthompson <https://github.com/calebthompson> what do you think?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#325 (comment)-
820681280>, or unsubscribe
<https://github.com/notifications/unsubscribe-
auth/AAFNYJLRBOJHWZVN22F4BSDTI45RNANCNFSM4ZV3TQ3A>.
|
Hi @calebthompson, yup Heroku uses database names, I think it was ClearDB that used unique schemas. Regardless this breaks from normal rails conventions, and as @derekprior mentioned, will also break multi-database support in Rails 6/6.1. Perhaps, making this an opt-out/in behavior with the default either enabled or disabled depending on whether it is opt-in or out? |
@derekprior @calebthompson
Besides that, (as mentioned before) the way scenic is working right now is a breaking behavior since it forces the search path on the If you open up any schema.rb after running a scenic view migration you can verify that only the scenic entries are doing this:
As @jdejong proposed, at the very least I would like to push for an opt-out mechanism. 🙏 |
This from @jdejong is the most compelling argument that our current implementation is wrong. Can this be substantiated by anyone? It's not that I don't trust @jdejong but since we're going back on an earlier change, I'd love some verification. |
@derekprior We'd love to have this functionality, too. Since Rails conventions don't include the schema when creating tables, the current implementation here is breaking for us since our different environments have different database (and schema) names. I'd love to see #327 merged. Thanks! |
Hopefully the above comment serve as verification? @derekprior |
When executing a migration the schema search path should not be included on the schema.rb since this is Environment dependant and will break on a different configuration:
Example of schema.rb generated because of scenic:
Expected schema.rb appendix is:
To be more specific, this breaks the following rake task for any env it runs with a different configuration than the one used to generate the
schema.rb
file.The text was updated successfully, but these errors were encountered: