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

Sort table names in mermaid file #34

Closed
austin-artificial opened this issue May 22, 2023 · 2 comments · Fixed by #35
Closed

Sort table names in mermaid file #34

austin-artificial opened this issue May 22, 2023 · 2 comments · Fixed by #35

Comments

@austin-artificial
Copy link
Contributor

Sometimes the ordering of the tables changes in the mermaid file after a schema changes (at least with postgres). This can make diffs on that file a bit noisy.

I propose that the tables are alphabetically sorted. This could be done here:

selectedTables, err := a.GetTables(db, selectedSchemas)
if err != nil {
return nil, err
}

so that it isn't up to the individual database analyzers to worry about this.

If this isn't desirable default behaviour, maybe we could put it behind a --sortTables flag.

I'd be happy to have a go at implementing this if the approach is agreed upon.

@KarnerTh
Copy link
Owner

Reasonable proposal - I would sort it by default without an additional flag, because there is no downside in doing so

Ideally sorting is done on database level, but in this limited use case it is perfectly fine with me to do it programmatically (as you mentioned, it can be done independent of the database that is used and performance shouldn't be an issue here)

Feel free to implement it if you like - I will happily accept PRs :) Otherwise I'm happy to do it myself

@KarnerTh
Copy link
Owner

The change is available in version 0.8.0

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 a pull request may close this issue.

2 participants