Easy way to clear database?
Noob here. My schema is massive and I don't want to have to manually type in all of my model names + deleteMany().
Doing that is also painful because a lot of times you have to delete things in a certain order.
I'm using prisma db push instead of migrations.
Anyone have an easy ts code snippet that will just completely wipe my database so I can seed everything again?
5 Replies
Can you do npx prisma reset
I believe that only works with migrations
Actually I can't even get npx prisma reset to work with the migration i just made
why not drop the db and just make it again with the same credentials?
or if you're at the point where you're going to be making those changes super often, just switch to sqlite for now and then you just have to delete the db file
since you're dropping everything and starting anew a lot, I highly recommend just using SQLite, it's pretty much the lowest possible overhead. It does lack some features that MySQL and Postgres have, but unless you need those SQLite is your friend.
@Duckstroyer good answer. Nice hair btw
Of course! And thanks 🙂