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 format.tableGroups option for table grouping #436

Closed
wants to merge 4 commits into from

Conversation

yasu89
Copy link
Contributor

@yasu89 yasu89 commented Feb 8, 2023

I am sorry to put out a series of PRs and I hope you will take a look at them when you have time πŸ™‡β€β™‚οΈ

About

For huge databases, the list of tables in the generated README.md is difficult to understand, so I implemented an option to group tables by user-specified groups.

resolve #311

Description

In the process of generating README.md with makeSchemaTemplateData() in output/md/md.go, tables are grouped in groups specified by the user and passed to the template.

Also, in the template, when a group of tables is provided, the template is implemented to display a list of tables by group.

In addition, I tried to output ER diagrams between tables within each group.
(In schema.go, we implemented a method called NewSchemaForTableGroup() that generates a new Schema when a list of tables is passed to it, which is then passed to the process that generates the ER diagram.)

Consultation matter

  • How to write a configuration file
    • At first, I thought of writing it as follows, but decided against it because the order is not guaranteed in a Map type, so it would have to be sorted in lexicographic order, and users would not be able to specify the order.
    • If there is a better way, I will re-implement it there.
format:
  tableGroups:
    user:
      - users
      - user_options
  • README.md format
    • I thought it would be easier to see if the table groups were closed, so I implemented them as if they were closed using the tags details and summary.
    • Also, since I implemented the display format according to my own preferences, I would like to re-implement it if there is a better format for this project.

@k1LoW
Copy link
Owner

k1LoW commented Feb 9, 2023

@yasu89 Thank you for the great feature.

Currently, I am trying to implement a feature in tbls that is similar to this pull request.

It is to introduce the viewpoint/view concept (ref: https://www.viewpoints-and-perspectives.info/ / https://www.sbcr.jp/product/4797376722/ ).

I have already implemented this in another tool called ndiag ( ref ).

I now consider the following.

  1. README.md is not changed. If necessary, have it adjusted using templates: .
  2. Create another page according to the viewpoints: settings. The page should display each viewpoint's grouped table list, ER diagram, and description.
  3. Create links to each viewpoint pages in the README.md if and only if viewpoints: is set.

The reason I want to introduce the concept of viewpoints/views is that the grouped tables should have a very important meaning and I want to highlight it.


So, your pull request is very nice, but I can't merge it as is. Sorry.

@yasu89
Copy link
Contributor Author

yasu89 commented Feb 9, 2023

@k1LoW
Thank you for explaining the future implementation.

I agree that grouped tables are certainly important and should be highlighted.
I look forward to waiting for the new features!

Thank you also for considering my PR!

@yasu89 yasu89 closed this Feb 9, 2023
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.

Generate schema per Database schema
2 participants