-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Problem
In the early stages of developing a new project, I find myself often repeating the following steps:
- Reset the database, using
psql
anddrop database <db_name>
- Push the new schema and regenerate the client, using
npx prisma db push
- Run the seed function, using
npx prisma db seed
In effect, I want to start from a clean slate with my seed data and new schema, and re-run my app. I wish this was easier to do in one command.
Suggested solution
I want a command like prisma db reset
that does the steps above: resets the database, pushes the new schema, regenerates the client, and runs the seed function.
Alternatives
I looked at npx prisma db push --force-reset
which does steps 1 and 2, but it doesn't run the seed function.
I looked at npx prisma migrate reset
but that doesn't push the schema to the database and instead tries to run migrations, which I don't use in the early stages of a product.
I ended up doing the steps manually each time. I suppose I could write my own npm script to do this, but it would be nice to use it with prisma directly since I'm used to using the prisma CLI commands.