drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
23.02k stars 552 forks source link

[FEATURE]: Add a possibility to add a comment on a Table, Column....... #886

Open snaidaGithub opened 1 year ago

snaidaGithub commented 1 year ago

Describe what you want

It would be great to add a comment on Tables, Columns .... So that you can describe the tables, columns in the drizzle-orm model and it's also in the database, e.g. a database admin also needs this info in the db.

Maybe like this:

export const DbRole = pgTable("role", {
  name: varchar("name", { length: 256 }).notNull().comment("The name of role, ....."),
  description: varchar("description", { length: 256, }).comment("The description, ....."),

  isActive: boolean("is_active").default(true).notNull().comment(" ....."),
  allowSignup: boolean("allow_signup").default(false).comment("....."),
  allowExternal: boolean("allow_external").default(false.comment("....."),
}).comment("The role .....");
lefnire commented 11 months ago

+1 for this. There are two important value-adds here:

  1. DB admin side, seeing what a column is for. Either at the SQL level (viewing a schema via DataGrip or whatever); or the code-level, a new dev looking through the schemas trying to understand the data layer. We're facing this issue currently, and of course the solution is code-level comments // number of employees at this organization. But:
  2. Dynamic usage. I'm working with GPT Functions for inserting data via Chat. If I had .comment(), I could table.reduce(...) the whole thing into JSON Schema where OpenAI requires parameter descriptions. For now I'm just copy/pasting all the schemas.

Obviously not critical, but a nice ergnomic.

aflatoon2874 commented 10 months ago

+1 for this. There are two important value-adds here:

  1. DB admin side, seeing what a column is for. Either at the SQL level (viewing a schema via DataGrip or whatever); or the code-level, a new dev looking through the schemas trying to understand the data layer. We're facing this issue currently, and of course the solution is code-level comments // number of employees at this organization. But:
  2. Dynamic usage. I'm working with GPT Functions for inserting data via Chat. If I had .comment(), I could table.reduce(...) the whole thing into JSON Schema where OpenAI requires parameter descriptions. For now I'm just copy/pasting all the schemas.

Obviously not critical, but a nice ergnomic.

+1 I want to add point 3

  1. Comments are critical to the functioning and security implementation for postgraphile v5 graphql implementation. Postgraphile v5 uses column and table level comments extensively for defining behaviours that are used by postgraphile runtime engine.
kiwamizamurai commented 5 months ago

Any updates on this??

expressgy commented 4 months ago

I am very much looking forward to this feature,COMMENT

Ivan-Baranov commented 3 months ago

+1

lebonnet commented 2 months ago

+1

ohbayashi-fvs commented 1 month ago

+1