Sample Conversion: SQL DDL → Prisma Schema
Input (SQL DDL)
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
name VARCHAR(100),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
); Output (Prisma Schema)
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
createdAt DateTime @default(now()) @map("created_at")
@@map("users")
} Frequently Asked Questions
How does SQL to Prisma conversion handle data types?
SERIAL/BIGSERIAL maps to Int/BigInt with @default(autoincrement()), VARCHAR maps to String, TIMESTAMP to DateTime, and BOOLEAN to Boolean.