Schemint

paste PostgreSQL or JSON, get your schema reviewed like a senior would

PostgreSQL CREATE TABLE to Prisma schema

Paste a CREATE TABLE, get Prisma models. Nothing you paste is stored.

Paste one or more PostgreSQL CREATE TABLE statements and get Prisma models ready to drop into schema.prisma. Foreign keys become @relation fields with the back-relation on the other side, snake_case columns get camelCase names with @map, VARCHAR(n) keeps its length via @db.VarChar, and defaults like now() and autoincrement() carry over.

Mapped from your real DDL, on the server, discarded after the response.

Try it on your own schema

Example

PostgreSQL in:

CREATE TABLE product (
    id BIGSERIAL PRIMARY KEY,
    sku VARCHAR(40) UNIQUE NOT NULL,
    name VARCHAR(200) NOT NULL,
    price NUMERIC(12, 2) NOT NULL,
    in_stock BOOLEAN NOT NULL DEFAULT true,
    created_at TIMESTAMP NOT NULL DEFAULT now()
);

Generated:

schema.prisma

model Product {
  id        BigInt   @id @default(autoincrement())
  sku       String   @unique @db.VarChar(40)
  name      String   @db.VarChar(200)
  price     Decimal  @db.Decimal(12, 2)
  inStock   Boolean  @default(true) @map("in_stock")
  createdAt DateTime @default(now()) @map("created_at")

  @@map("product")
}

Related