k1LoW / tbls

tbls is a CI-Friendly tool for document a database, written in Go.
MIT License
3.4k stars 166 forks source link

Output schema data file by default #387

Closed k1LoW closed 1 year ago

k1LoW commented 1 year ago
  1. I'm thinking of making a change so that schema data (JSON) is also output by default when the tbls doc command is executed.
    • It is also possible to output it with tbls out -t json even now.
    • Also add a setting to disable output of schema data
  2. I plan to use the schema data in 1 to create commands to handle the schema without accessing the database (e.g., tbls ls-tables).

I also want the schema data files to be committed to the repository. I believe this will make tools such as https://github.com/harakeishi/trv more powerful.

I am currently struggling with two points.

  1. File name of schema data
    • schema.json
    • .schema.json
    • tbls.schema.json
    • .tbls.schema.json
    • tbls.schema
    • .tbls.schema
    • etc...
  2. Output path of schema data file
    • Same directory as .tbls.yml
    • Same directory as the generated schema document
    • Always working directory
    • etc...

If you have any advice or input, I'd love to hear it.

atsushi-ishibashi commented 1 year ago
  1. File name of schema data

tbls.schema.json. Because

  1. Output path of schema data file

Same directory as the generated schema document when you run tbls doc, it may generate a lot of diff in git. So I prefer to have them in one directory.

wate commented 1 year ago
  1. File name of schema data

_schema.json

  1. Output path of schema data file

Same directory as the generated schema document

k1LoW commented 1 year ago

@atsushi-ishibashi @wate Thanks for your input!!!!!

If you can, I'd appreciate some more input. Of course, if you ignore it, no problem!


@atsushi-ishibashi

schema.json is common name so it may conflict any file so not schema.json.(this depends on output path)

If the directory that outputs the schema data is the same directory as the generated schema document, do you think it would matter if the file name was schema.json ( not tbls.schema.json )?


@wate

_schema.json

What is the purpose of the _ in the filename?

Do you know of any tools that have a similar strategy?

atsushi-ishibashi commented 1 year ago

If the directory that outputs the schema data is the same directory as the generated schema document, do you think it would matter if the file name was schema.json ( not tbls.schema.json )?

yes, it doesn't matter👍

wate commented 1 year ago

@k1LoW

What is the purpose of the _ in the filename? Do you know of any tools that have a similar strategy?

the reasons are as follows

k1LoW commented 1 year ago

Thank you all for your input.

I would implement the following

1. File name of schema data

schema.json

explicit file extension. .json content guessable file name. .schema

I would like it to remain listed first when sorted by file name.

I decided that schema.json is only a file used by the program, so there is no need to make it easy to find.

I don't want to treat it as an invisible file.

Yes

  1. Output path of schema data file

Same directory as the generated schema document

when you run tbls doc, it may generate a lot of diff in git. So I prefer to have them in one directory.

Yes