`prisma pull` should add `///` comments based on postgres's `COMMENT`
See original GitHub issueProblem
On Postgres database one can have COMMENT ON different database objects (tables, columns, types).
When generating prisma file from such database comments are written in the generated file. Tho doing so would be great!
Suggested solution
When generating prisma file look up object descriptions and use those as comments in generated prisma file.
Example
If your database dump looks like this:
CREATE TYPE foo AS ENUM('fiz', 'foz');
COMMENT ON TYPE foo IS 'foo comment';
CREATE TABLE IF NOT EXISTS bar
(
id bigserial unique primary key,
foo foo not null
);
COMMENT ON TABLE bar IS 'bar comment';
COMMENT ON COLUMN bar.id IS 'bar.id comment';
in a Postgres database, and then you run prisma pull
, you shold get:
/// bar comment
model bar {
/// bar.id comment
id BigInt @id @default(autoincrement())
foo foo
}
/// foo comment
enum foo {
fiz
foz
}
Related:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:18
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Prisma schema (Reference)
A data source (PostgreSQL or MongoDB); A generator (Prisma Client) ... comment : These comments will show up in the abstract syntax tree...
Read more >Prisma schema API (Reference)
API reference documentation for the Prisma Schema Language (PSL).
Read more >PostgreSQL database connector (Reference) - Prisma
Prisma is based on the official PostgreSQL format for connection URLs, but does not support all arguments and includes additional arguments such as...
Read more >Names in the underlying database - Prisma
With this modified model definition, Prisma automatically maps the Comment model to the comments table in the underlying database. Map field / column...
Read more >Prisma Client API (Reference)
The Prisma Client API reference documentation is based on the following schema: ... Remarks. You must re-generate the Prisma Client each time you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not right now, now: https://pris.ly/roadmap But that does not mean it could be implemented soon - we are rather conservative how much we plan.
It is just a statement of a current fact: Prisma currently does not support reading or modifying the comments of tables and columns in databases, but we do support
//
and///
in the Prisma Schema file and use that data in different situations and locations.