Prisma Next introduces a `dataTransform` operation that lets developers write data migrations in TypeScript alongside schema changes, using the same type-safe query builder as application code. Instead of raw SQL or out-of-band scripts, a `dataTransform` takes `check` and `run` callbacks typed against a contract snapshot specific to that migration point. The migration file compiles to a JSON ops file committed to the repo, which is what the migration runner executes — never the TypeScript itself. This approach provides autocomplete, type checking, pre/post-checks on every operation, and reviewable SQL output. It works for both SQL databases and MongoDB, and is available in Prisma Next Early Access (not yet production-ready).

8m read timeFrom prisma.io
Post cover image
Table of contents
Today, you have two options to update your dataIn Prisma Next, you write the data step in TypeScriptWhat dataTransform compiles toIn practice, and with agentsEach migration has its own contractMongoDB gets data transformations tooTry it yourself