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 support for comments #6

Open
bhenderson opened this issue Aug 27, 2021 · 1 comment
Open

add support for comments #6

bhenderson opened this issue Aug 27, 2021 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@bhenderson
Copy link
Contributor

We recently started putting comments into our database and we thought it would be awesome if this lib could add the comments as documentation in the output. This might be specific to postgres so I'm not sure how that would work. Potentially this lib could just offer a hook so we could add our own documentation before the typescript definition.

We add comments like this:

-- table
comment on table my_table is 'This is my table';

-- column
comment on column my_column.id is 'PK of my_table';

actually, the more I think about it, general hooks is probably the way to go. This would also solve my problems for #5 and #4.

great library by the way, it has been super helpful!

@koistya
Copy link
Member

koistya commented Aug 28, 2021

Good idea! Generating JSDoc comments from the actual database schema would be nice. At least for database tables. It can be done by integrating the following SQL query into the lib:

SELECT description FROM pg_description
  JOIN pg_class ON pg_description.objoid = pg_class.oid
  JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
WHERE relname = '<table name>' AND nspname='<schema name>'

@koistya koistya added good first issue Good for newcomers help wanted Extra attention is needed labels Aug 28, 2021
@bhenderson bhenderson reopened this Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants