DEV Community

Prisma + Postgres

awalias on October 30, 2024

In this tutorial, we'll explore how to set up Prisma + Postgres. We'll use real-world examples involving books and authors. Prerequisites...
Collapse
 
awalias profile image
awalias • Edited

If anyone needs help regarding Prisma / Postgres you can get support in our discord

Collapse
 
steve_val profile image
Steve_Val

The memes in there are crazy lol

Also note for anyone else who's wondering the official Prisma documentation related to this is here: prisma.io/docs/orm/overview/databa...

The important step adding

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL")
}
Enter fullscreen mode Exit fullscreen mode

Very nice.

Collapse
 
swamp_dog profile image
swamp_dog

I was trying initially without the direct_url but apparently it's required if you need to do migrations.

Collapse
 
joshenlim profile image
Joshen Lim

Hopefully this might be helpful - there's a set of handy instructions on your projects' home page if you click the "Connect" button and select the "ORMs" tab
Image description

Collapse
 
supabase_io profile image
Supabase

Yes! Thanks for sharing @joshenlim

Collapse
 
supa_community profile image
Supabase Community

Prisma Postgres is an incredible pairing for a backend. Both tools are used and loved by the Supabase Community.

Collapse
 
sivenruot profile image
Lee AVULAT

Nice guide. I would add that if you want to use prisma to generate migrations. For those to be usable with supabase-js and postgrest I recommend to leverage the native database functions in your "id" definitions like mentioned here: github.com/supabase/cli/issues/277...

Collapse
 
thorwebdev profile image
Thor 雷神

You can also find some details on using Row Level Security (RLS) with Prisma here: supabase.com/partners/integrations...

Collapse
 
4l3k51 profile image
Aleksi Immonen

Excellent guide !

Collapse
 
encima_49 profile image
Chris • Edited

thanks for this! If I am using a pooler like Supavisor does that mean I do not use Accelerate or anything, just the Prisma library and Supabase handles the rest?

Collapse
 
4l3k51 profile image
Aleksi Immonen

Excellent guide!