Introducing db-diff — a helper library for generating up and down migrations for Platformatic DB using Prisma

|1 min read

I’m excited to share a mini-project of mine, db-diff. 🎉

db-diff is a helper library built on top of the Prisma CLI for auto-generating and versioning customizable database migrations for Platformatic DB. It allows you to use the Prisma schema for data modeling, and then generate auto-generate migrations.

Under the hood, it utilizes the prisma migrate diff command that compares your Prisma schema and database schema, and generates a SQL file.

To get started, install the package as a development dependency

npm i --save-dev @ruheni/db-diff

…and if you already have a Prisma schema in your project, you can generate up and down migrations by running:

npx db-diff

Here’s a demo video of how db-diff works:

If you’re working with Platformatic and Prisma in your project, try it out, create a GitHub issue if you run into a a bug, and give the repository a ⭐️. Feel free to reach out if you have any questions.

Happy hacking! 👨🏽‍💻