How to add table/column comments when creating tables?
Hey, we're approaching close to 100 tables in our project. New people will be joining our founding team and we thought documenting the tables using the Postgres table/column commenting feature would make it easier to understand the DB schema.
After searching the docs, discord, and google, I couldn't find any info on how to do this in Kysely. Should we resort to raw SQL? Thanks!
Solution:Jump to solution
Hey 👋
Kysely supports column comments in introspectors. This should allow external codegen tools (e.g. kysely-codegen) to generate types with jsdocs.
Builders don't have built-in support for adding comments on tables or columns. You can use
modifyEnd
where possible to add comments with sql
template tag....3 Replies
Solution
Hey 👋
Kysely supports column comments in introspectors. This should allow external codegen tools (e.g. kysely-codegen) to generate types with jsdocs.
Builders don't have built-in support for adding comments on tables or columns. You can use
modifyEnd
where possible to add comments with sql
template tag.
Thank you!!
We might have missed a few spots with
modifyEnd
, so if you see any that miss it, let us know.