Edit seed db function

This commit is contained in:
Aaron William Po
2023-01-22 23:49:58 -05:00
parent 0065525f5c
commit f08731de17
21 changed files with 1115 additions and 166 deletions

View File

@@ -0,0 +1,13 @@
import DBClient from '../../DBClient';
const cleanDatabase = async () => {
const prisma = DBClient.instance;
await prisma.$executeRaw`TRUNCATE TABLE "User" CASCADE`;
await prisma.$executeRaw`TRUNCATE TABLE "BeerPost" CASCADE`;
await prisma.$executeRaw`TRUNCATE TABLE "BeerType" CASCADE`;
await prisma.$executeRaw`TRUNCATE TABLE "BreweryPost" CASCADE`;
await prisma.$executeRaw`TRUNCATE TABLE "BeerComment" CASCADE`;
await prisma.$executeRaw`TRUNCATE TABLE "BreweryComment" CASCADE`;
};
export default cleanDatabase;