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

Add flag to sort tables alphabetically #17

Merged
merged 4 commits into from
Jul 10, 2024
Merged

Conversation

seyoungjkim
Copy link
Collaborator

@seyoungjkim seyoungjkim commented Jul 10, 2024

This PR adds the option to sort tables alphabetically in the output schema file. If the flag is not set, tables will be output in whatever order returned by the query.

I tested by running on a DB with and without the flag and observed the correct output when the flag was set.


$ ./bin/sql-gen-doc -dsn 'user:password@tcp(localhost:3306)/database_to_generate' -out outfile.md
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty!

@@ -22,8 +22,10 @@ Usage of ./bin/sql-gen-doc:
a data source name for the database, e.g. user:password@tcp(mysql:3306)/database_name
-o string
the outfile to write the documentation to, if no outfile is specified, the output is written to stdout
--sort-tables
outputs tables in alphabetical order
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should make this the default once we hit 1.0

otherwise I think the behavior is somewhat nondeterministic? (or based upon the order that the dbs are created)

Copy link
Owner

@ntindall ntindall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌱

@ntindall ntindall merged commit bb0695b into master Jul 10, 2024
1 check passed
@ntindall ntindall deleted the sk-2024-07-10-alphabetize branch July 10, 2024 19:44
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.

2 participants