Is there a way I can create a temporary table with custom data which I then can reference?
I'm building a chat application where I have a model
threads
and activities
. I'm also keeping track of what the latest activity
a specific user has read. This allows me to calculate the "number of unread messages". I would like to query the number of unread messages per thread in one database query. I'm using Postgres.
Below is my code, please note that the .with()
method is broken. But I wanted to paint a picture of what I wanted to do.
Thanks in advance,
Victor2 Replies
You're looking for db.$with
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.