Skip to content
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

Merged
merged 4 commits into from
Jul 22, 2024

Conversation

cdinger
Copy link
Owner

@cdinger cdinger commented Jul 19, 2024

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.

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.
@cdinger
Copy link
Owner Author

cdinger commented Jul 19, 2024

@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?

@whit0694
Copy link
Contributor

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
Copy link

👍

@cdinger
Copy link
Owner Author

cdinger commented Jul 22, 2024

@IanWhitney if I merge this into main would you be willing to test drive it on one of your projects?

@IanWhitney
Copy link

Sure. Did you want to cut a release or have me grab the gem directly from the repo?

@cdinger
Copy link
Owner Author

cdinger commented Jul 22, 2024

After I merge I'm hoping you can change your Gemfile to:

gem "scenic-oracle_adapter", git: "https://github.umn.edu/cdinger/scenic-oracle_adapter", branch: "main"

and give it a spin before we cut a new release.

@cdinger cdinger merged commit 6df873a into main Jul 22, 2024
2 checks passed
@cdinger cdinger deleted the fallback_sorting_for_missing_dependency_views branch July 22, 2024 16:10
@IanWhitney
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants