You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/200-orm/050-overview/500-databases/300-postgresql.mdx
+29-4Lines changed: 29 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,22 +81,47 @@ Notice that this code requires the `DATABASE_URL` environment variable to be set
81
81
82
82
### Notes
83
83
84
-
#### Specifying a PostgreSQL schema
84
+
#### Configuring the schema for Prisma queries (most common case)
85
85
86
-
You can specify a [PostgreSQL schema](https://www.postgresql.org/docs/current/ddl-schemas.html)by passing in the `schema` option when instantiating `PrismaPg`:
86
+
In Prisma 7, you configure the schema that Prisma uses when generating queries by passing a `schema` option when creating the `PrismaPg` instance. This is the recommended approach for most users who previously used the `schema` URL parameter in Prisma 6.
87
87
88
88
```ts
89
89
const adapter =newPrismaPg(
90
90
{ connectionString },
91
-
{ schema: 'myPostgresSchema' }
91
+
{ schema: 'myPostgresSchema' }// Optional: specify the default schema
92
92
)
93
93
```
94
94
95
+
:::note
96
+
**For Prisma 6 users**: In Prisma 6, you may have used a `?schema=` parameter in your connection URL. In Prisma 7, you must use the `schema` option shown above instead. This change makes the schema configuration more explicit and consistent across database adapters.
97
+
:::
98
+
99
+
#### Configuring the search path for raw SQL queries (less common case)
100
+
101
+
If you need to set the search path for raw SQL queries (where you refer to tables without schema qualification), use PostgreSQL's native `options` parameter in your connection string. This is only necessary if you're using raw queries that reference tables without their schema name.
Both syntaxes are supported by the underlying `pg` driver. This approach is only needed for raw SQL queries - for Prisma Client queries, use the `schema` option shown above.
114
+
95
115
## Connection details
96
116
97
117
### Connection URL
98
118
99
-
Prisma ORM follows the connection URL format specified by [PostgreSQL's official guidelines](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING), but does not support all arguments and includes additional arguments such as `schema`. Here's an overview of the components needed for a PostgreSQL connection URL:
119
+
Prisma ORM follows the connection URL format specified by [PostgreSQL's official guidelines](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING). Note that in Prisma 7, the custom `schema` URL parameter that was available in Prisma 6 is no longer supported. Instead:
120
+
121
+
1. For configuring the schema used by Prisma's query builder, use the `schema` option when creating the `PrismaPg` instance
122
+
2. For setting the search path for raw SQL queries, use PostgreSQL's native `options` parameter in the connection URL
123
+
124
+
Here's an overview of the components needed for a PostgreSQL connection URL:
100
125
101
126

Copy file name to clipboardExpand all lines: content/200-orm/050-overview/500-databases/890-neon.mdx
+24-3Lines changed: 24 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,12 +153,33 @@ You can then use Prisma Client as you normally would with full type-safety. Pris
153
153
154
154
### Notes
155
155
156
-
#### Specifying a PostgreSQL schema
156
+
#### Configuring the schema for Prisma queries (most common case)
157
157
158
-
You can specify a [PostgreSQL schema](https://www.postgresql.org/docs/current/ddl-schemas.html)by passing in the `schema` option when instantiating `PrismaNeon`:
158
+
In Prisma 7, you configure the schema that Prisma uses when generating queries by passing a `schema` option when creating the `PrismaNeon` instance. This is the recommended approach for most users who previously used the `schema` URL parameter in Prisma 6.
159
159
160
160
```ts
161
161
const adapter =newPrismaNeon(
162
162
{ connectionString },
163
-
{ schema: 'myPostgresSchema' })
163
+
{ schema: 'myPostgresSchema' } // Optional: specify the default schema
164
+
)
164
165
```
166
+
167
+
:::note
168
+
**For Prisma 6 users**: In Prisma 6, you may have used a `?schema=` parameter in your connection URL. In Prisma 7, you must use the `schema` option shown above instead. This change makes the schema configuration more explicit and consistent across database adapters.
169
+
:::
170
+
171
+
#### Configuring the search path for raw SQL queries (less common case)
172
+
173
+
If you need to set the search path for raw SQL queries (where you refer to tables without schema qualification), use PostgreSQL's native `options` parameter in your connection string. This is only necessary if you're using raw queries that reference tables without their schema name.
Both syntaxes are supported by the underlying `pg` driver. This approach is only needed for raw SQL queries - for Prisma Client queries, use the `schema` option shown above.
0 commit comments