Hi, I want to reset the my prisma postgres databas...
# orm-help
t
Hi, I want to reset the my prisma postgres database before each test suite in cypress. I’m using this command:
cy.exec(‘npm run db:reset’)
which runs this script:
Copy code
echo “DROP DATABASE foodplanet WITH (FORCE); CREATE DATABASE foodplanet;” | sudo docker exec -i foodplanet psql -U postgres
cat prisma/backup/development_data.sql | sudo docker exec -i foodplanet psql -U postgres foodplanet
However, sometimes I get the error:
Copy code
PrismaClientKnownRequestError3 [PrismaClientKnownRequestError]:
Invalid `prisma.nutrient.findMany()` invocation:
  Server has closed the connection.
I think it is because the webapp is doing an API request in the same moment as the reset command gets executed. Does anybody know how to stop all current requests or the whole webapp during the execution of the command? The problem is that the cypress test fails because of the 500 server error. Is there another way to reset the whole database between test suits? (I don’t want to use prisma seed because it is too slow)