* WIP * WIP - MultiObjectSearch * WIP * WIP * Finished working version * Fix * Fixed and cleaned * Fix * Disabled files and emails for custom objects * Cleaned console.log * Fixed attachment * Fixed * fix lint --------- Co-authored-by: Charles Bochet <charles@twenty.com>
18 lines
466 B
TypeScript
18 lines
466 B
TypeScript
import { PrismaClient, Prisma } from '@prisma/client';
|
|
|
|
import { camelCase } from 'src/utils/camel-case';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
export default async () => {
|
|
const models = Prisma.dmmf.datamodel.models;
|
|
const modelNames = models.map((model) => model.name);
|
|
const entities = modelNames.map((modelName) => camelCase(modelName));
|
|
|
|
await prisma.$transaction(
|
|
entities.map((entity) => {
|
|
return prisma[entity].deleteMany();
|
|
}),
|
|
);
|
|
};
|