Skip to content

Commit

Permalink
Merge branch 'main' into remove-legacy-pdp-content
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasburk authored Jan 23, 2024
2 parents 47dedaa + 1cb40c3 commit e718122
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 14 deletions.
17 changes: 8 additions & 9 deletions content/200-orm/050-overview/500-databases/880-supabase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,21 @@ Many aspects of using Prisma with Supabase are just like using Prisma with any o

## Specific considerations

If you'd like to use the [connection pooling feature](https://supabase.com/docs/guides/integrations/prisma#connection-pooling-with-supabase) available with Supabase, you will
need to add `pgbouncer=true` to the end of the `DATABASE_URL` environment variable used in the `datasource.url` property:
If you'd like to use the [connection pooling feature](https://supabase.com/docs/guides/database/connecting-to-postgres#connection-pooler) available with Supabase, you will need to use the connection pooling connection string available via your [Supabase database settings](https://supabase.com/dashboard/project/_/settings/database) with `?pgbouncer=true` appended to the end of your `DATABASE_URL` environment variable:

```env file=.env
# Connect to Supabase with PgBouncer.
DATABASE_URL="postgres://postgres.__YOUR_SUPABASE_PROJECT__:__PASSWORD__@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true"
# Connect to Supabase via connection pooling with Supavisor.
DATABASE_URL="postgres://postgres.[your-supabase-project]:[password]@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true"
```

If you would like to use the Prisma CLI in order to perform other actions on your database (e.g. migrations) you will need to add a `DIRECT_URL` environment variable to use in the `datasource.directUrl` property so that the CLI can bypass PgBouncer:
If you would like to use the Prisma CLI in order to perform other actions on your database (e.g. migrations) you will need to add a `DIRECT_URL` environment variable to use in the `datasource.directUrl` property so that the CLI can bypass Supavisor:

```env file=.env highlight=4-5;add
# Connect to Supabase with PgBouncer.
DATABASE_URL="postgres://postgres.__YOUR_SUPABASE_PROJECT__:__PASSWORD__@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true"
# Connect to Supabase via connection pooling with Supavisor.
DATABASE_URL="postgres://postgres.[your-supabase-project]:[password]@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true"
# Direct connection to the database. Used for migrations.
DIRECT_URL="postgres://postgres:__PASSWORD__@db.__YOUR SUPABASE_PROJECT__.supabase.co:5432/postgres"
DIRECT_URL="postgres://postgres:[password]@db.[your-supabase-project].supabase.co:5432/postgres"
```

You can then update your `schema.prisma` to use the new direct URL:
Expand All @@ -62,7 +61,7 @@ More information about the `directUrl` field can be found [here](/orm/reference/

<Admonition type="info">

We strongly recommend using `pgbouncer` in addition to `DIRECT_URL`. You will gain the great developer experience of the Prisma CLI while also allowing for connections to be pooled regardless of deployment strategy. While this is not strictly necessary for every app, serverless solutions will inevitably require connection pooling.
We strongly recommend using connection pooling with Supavisor in addition to `DIRECT_URL`. You will gain the great developer experience of the Prisma CLI while also allowing for connections to be pooled regardless of your deployment strategy. While this is not strictly necessary for every app, serverless solutions will inevitably require connection pooling.

</Admonition>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Below are links to information on how to set up these connections with providers

## Supabase Supavisor

Supabase's Supavisor behaves similar to [PgBouncer](#pgbouncer). You can add `pgbouncer=true` to your connection pooled connection string.
Supabase's Supavisor behaves similarly to [PgBouncer](#pgbouncer). You can add `?pgbouncer=true` to your connection pooled connection string available via your [Supabase database settings](https://supabase.com/dashboard/project/_/settings/database).

## Other external connection poolers

Expand Down
7 changes: 7 additions & 0 deletions src/html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ const HTML = (props: any) => {
data-project-logo="https://www.prisma.io/docs/ai_logo.png"
data-button-text="Ask AI"
data-modal-example-questions="How can I setup relations in my schema file?,What is the difference between the 'migrate dev' and 'db push' commands?,Which cache strategy should I use for my query with Prisma Accelerate?,How can I subscribe to database events with Prisma Pulse?"
data-button-image="https://www.prisma.io/docs/ai_button.svg"
data-button-text-color="#71E8DF"
data-button-bg-color="#2D3748"
data-button-border="2px"
data-button-border-color="#71e8df"
data-button-border-style="solid"
data-button-box-shadow="drop-shadow(0px 0.724px 1.251px rgba(14, 18, 28, 0.02)) drop-shadow(0px 1.608px 2.909px rgba(14, 18, 28, 0.04)) drop-shadow(0px 2.793px 5.225px rgba(14, 18, 28, 0.06)) drop-shadow(0px 4.55px 8.671px rgba(14, 18, 28, 0.07)) drop-shadow(0px 7.485px 14.285px rgba(14, 18, 28, 0.08)) drop-shadow(0px 13.358px 24.966px rgba(14, 18, 28, 0.09)) drop-shadow(0px 33px 54px rgba(14, 18, 28, 0.07))"
></script>

{/* OneTrust Cookies Consent Notice start for prisma.io */}
Expand Down
17 changes: 13 additions & 4 deletions src/styles/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,6 @@ a.question::before {
}
}

.gatsby-resp-image-wrapper {
margin-left: inherit !important;
}

/* Kapa.ai overrides */
#kapa-widget-container .mantine-Button-root {
z-index: 1000;
Expand All @@ -596,6 +592,14 @@ a.question::before {

#kapa-widget-container .mantine-Text-root {
font-size: 1rem;
color: #71e8df;
filter: drop-shadow(0px 0.724px 1.251px rgba(14, 18, 28, 0.02))
drop-shadow(0px 1.608px 2.909px rgba(14, 18, 28, 0.04))
drop-shadow(0px 2.793px 5.225px rgba(14, 18, 28, 0.06))
drop-shadow(0px 4.55px 8.671px rgba(14, 18, 28, 0.07))
drop-shadow(0px 7.485px 14.285px rgba(14, 18, 28, 0.08))
drop-shadow(0px 13.358px 24.966px rgba(14, 18, 28, 0.09))
drop-shadow(0px 33px 54px rgba(14, 18, 28, 0.07));
}

#kapa-widget-container .mantine-Image-image {
Expand All @@ -607,6 +611,7 @@ a.question::before {
height: 4rem !important;
width: 4rem !important;
border-radius: 8px;
border: 2px solid #71e8df !important;
}

#kapa-widget-container .mantine-Stack-root {
Expand All @@ -616,3 +621,7 @@ a.question::before {
.mantine-Modal-body img {
margin-bottom: 0;
}

.gatsby-resp-image-wrapper {
margin-left: inherit !important;
}
17 changes: 17 additions & 0 deletions static/ai_button.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e718122

Please sign in to comment.