FREE TOOL

SQL to Prisma schema converter

Paste your CREATE TABLE statements and get a ready-to-use Prisma schema — models, field types, relation fields, and unique constraints inferred automatically from your DDL.

YOUR SQL
PRISMA OUTPUT
// Generated by ERD Factory - review relation/field names before use.


generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model Users {
  id Int @id @default(autoincrement())
  email String
  full_name String?
  created_at DateTime?
  last_login_at DateTime?
  orderss Orders[]
  @@map("users")
}

model Orders {
  id Int @id @default(autoincrement())
  user_id Int?
  status String
  total_cents Int
  currency String?
  placed_at DateTime?
  shipped_at DateTime?
  user Users? @relation(fields: [user_id], references: [id])
  orderItemss OrderItems[]
  paymentss Payments[]
  @@map("orders")
}

model OrderItems {
  id Int @id @default(autoincrement())
  order_id Int? @unique
  product_id Int
  quantity Int
  order Orders? @relation(fields: [order_id], references: [id])
  @@map("order_items")
}

model Products {
  id Int @id @default(autoincrement())
  sku String
  name String
  price_cents Int
  inventory_count Int?
  active Boolean?
  orderItemss OrderItems[]
  @@map("products")
}

model Payments {
  id Int @id @default(autoincrement())
  order_id Int? @unique
  amount_cents Int
  method String
  processed_at DateTime?
  order Orders? @relation(fields: [order_id], references: [id])
  @@map("payments")
}

model Sessions {
  id Int @id @default(autoincrement())
  token String
  expires_at DateTime?
  @@map("sessions")
}

See these 6 tables as an interactive diagram, get AI-suggested fixes, and save your schema — free.

Open in the full editor

Find the gaps before
production does.

Paste a schema and see your first analysis in under ten seconds.

ERD Factory

Schema visualization & analysis for people who ship databases.

© 2026 ERD Factory