mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
patFix schema so beer image and brewery image have createdBy column. Rename 'url' to 'path' in schema, add 'caption' column.
19 lines
761 B
TypeScript
19 lines
761 B
TypeScript
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`;
|
|
await prisma.$executeRaw`TRUNCATE TABLE "BeerPostLike" CASCADE`;
|
|
await prisma.$executeRaw`TRUNCATE TABLE "BeerImage" CASCADE`;
|
|
await prisma.$executeRaw`TRUNCATE TABLE "BreweryImage" CASCADE`;
|
|
|
|
await prisma.$disconnect();
|
|
};
|
|
|
|
export default cleanDatabase;
|