How do I check if a text column is empty or null with Prisma JS

Viewed 82

I am using Postgresql and Prisma as an ORM. I have a table with a text column and I have many rows in the table where the value of this column is null or empty.

Is there a special way to determine whether the value of a text column is null or empty ?

On sql i would do something like :

SELECT * FROM myTable WHERE myColumn IS NULL OR myColumn = ''
1 Answers

You could try something like this with the Prisma client:

const records = await prisma.record.findMany({
  where: {
    OR: [{ myColumn: null }, { myColumn: "" }],
  },
});
Related