Reputation: 131
I've followed the official documentation(https://www.prisma.io/docs/orm/prisma-schema/data-model/views) of Prisma in order to fetch data from a view.
If I use $queryraw i'm able to fetch the data but when i use the client like: prisma.BalanceTransacionView.findMany() it states that the The table public.BalanceTransactionView does not exist in the current database.
I've added the view to the prisma.schema and run prisma generate so I can use the prisma client to the new generated view but when i deploy it it just gives the error above.
view BalanceTransactionView {
id String @unique
etc...
}
I suspect that I'm missing a step to make it available when i deploy it but i didn't create a migration so didn't want to create a migration unnecessarily.
If you can through some light into it could be very nice :) Thanks!
Upvotes: 0
Views: 183
Reputation: 131
I've made it work. I needed to introspect the db with npx prisma db pull
and then change the generated view on the prisma.schema and that made it work.
Resolving question.
Upvotes: 0