Tom
08/17/2021, 1:31 PMcy.exec(‘npm run db:reset’)
which runs this script:
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:
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)