Convert Your SQL Schema to a Prisma Schema with Claude
Migrating an existing database to Prisma means translating your DDL into Prisma's schema language by hand — or you can just ask Claude to do it.
Dump your schema and pipe it straight in:
pg_dump --schema-only mydb | claude -p "Convert this PostgreSQL DDL into a valid Prisma schema. Infer all relations from foreign key constraints, map PostgreSQL types correctly, and add @@map and @map attributes to preserve the original table and column names."
Claude handles the tricky parts: composite primary keys, enums, JSON columns, self-referential relations, and many-to-many join tables that Prisma needs to model as implicit or explicit relations.
For a Laravel project migrating to a Node.js backend, the combination is especially useful:
cat database/migrations/*.php | claude -p "Extract the final schema state from these Laravel migration files and produce a Prisma schema file with correct relations and types."
Once the schema is generated, ask Claude to keep going:
claude "Now generate Prisma seed data in seed.ts that matches the existing fixtures in tests/fixtures/. Use the Prisma client we just created."
You can also ask Claude to spot any differences between your introspected schema and the Prisma output — a good sanity check before running migrations.
Claude turns a multi-hour schema migration into a single session — just verify the relations before you run prisma migrate.
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.