scenic
scenic copied to clipboard
Add topological sorting for dumped views using TSort
This introduces topological sorting (https://ruby-doc.org/stdlib-2.6.8/libdoc/tsort/rdoc/TSort.html#method-i-tsort) for views in dumps which will sort views alphabetically and in case of dependencies between views will use a topological sorting. That provides a consistent views ordering in database dumps and prevents of having occasional diffs in schema dumps.
Based on discussion here https://github.com/scenic-views/scenic/issues/263 and code samples https://github.com/scenic-views/scenic/issues/263#issuecomment-679167557 and https://github.com/scenic-views/scenic/issues/263#issuecomment-875009521
Not sure how do you deal with the Hound so made a separate commit to satisfy it
This is great, thank you @msorc this one saved us a bunch of time. Any thoughts on merging this one @derekprior @calebhearth, as it relates to #263. Anvyl would be happy to help QA a pre-release version.
Anyone please merge this to clean up the schema diffs :(
I've rebased this in #398 (but would be fine closing that if @msorc hasn't gotten fed up with me and wants to rebase this themselves) and plan to test this out now that I have an app that sees this issue, which I'm very excited about.
No, I don't want to rebase it myself :) @calebhearth please proceed whichever way to finally merge it.
Check my comments above - schema_dumper.rb
needs schema on lines 73-74. We are using fork with those changes for almost year without issues.
superseded by #398