Postgresql schema for prisma graphql client

it is easy to create schema of database with prisma introspect

in prisma folder .env file must contain

DATABASE_URL=postgresql://myuser:myPassword@myhost:port/mydatabase?schema=myschema

in your schema.prisma file just write

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

then here is the code

npx prisma introspect

your schema.prisma file automatically changed like this.

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model messages {
message_id Int @id
subject String?
message String
user_id Int
message_date DateTime?
is_deleted Boolean? @default(false)
}

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response