-
Notifications
You must be signed in to change notification settings - Fork 7
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
Provide fallback view sorting #22
Conversation
This provides a default fallback sorting if a view is missing from the increasingly complex `view_dependencies` query. We've already encountered several edge cases were views are missing or misclassified in Oracle's `user_dependencies` view. If a new edge case pops up this should not explode on a failed index lookup. Instead it will be added to the end of the sorted views array.
@whit0694 I'd like to get your thoughts on this. I don't like that the schema dumper fails catastrophically if a view is missing from the dependencies. This change ensures missing dependency views are added to the end of the dependency-sorted array. Do you think these missing views should be added to the front or the back of the sorted array? |
Yeah, I can see that. I'm wondering if these changes will help stabilize the output of schema.rb. We get a lot of churn in that file, as the order of things seems to vary by environment. I'd like to make it more deterministic. |
Views were being sorted base on their dependencies to other objects, but within those contraints there was no specified order. This sorted views alphabetically within the existing dependency ordering. Any views that are missed in the dependency query are also sorted alphabetically.
👍 |
@IanWhitney if I merge this into main would you be willing to test drive it on one of your projects? |
Sure. Did you want to cut a release or have me grab the gem directly from the repo? |
After I merge I'm hoping you can change your Gemfile to:
and give it a spin before we cut a new release. |
Seems to be working as I'd expect. I'm able to build a schema.rb file and it looks like the order will be consistent. I think it's fine to release, though we may find things to change after more usage. |
This provides a default fallback sorting if a view is missing from the increasingly complex
view_dependencies
query. We've already encountered several edge cases were views are missing or misclassified in Oracle'suser_dependencies
view.If a new edge case pops up this should not explode on a failed index lookup. Instead it will be added to the end of the sorted views array.