Hey. I want to run a weekly cleanup job on our database to get rid of some data from clients which no longer use our services. Because we have many tables, and more are being added regularly is there a good way of looping through every table without having to add hard coded values? I am using prisma client with TS
✅ 1
n
Nurul
02/11/2022, 4:57 AM
Hey @Logan 👋,
If you want to get all the table names, you should be able to get it by using
dmmf
property of
PrismaClient
instance.
Copy code
const prisma = new PrismaClient();
console.log(prisma._dmmf);