Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/200-orm/050-overview/500-databases/900-turso.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ LIBSQL_DATABASE_TOKEN="..."

### 3. Set up Prisma Config file

Make sure that you have a [`prisma.config.ts`](/orm/reference/prisma-config-reference) file for your project. Then, set up the [migration driver adapter](/orm/reference/prisma-config-reference#adapter) to use `PrismaLibSQL`:
Make sure that you have a [`prisma.config.ts`](/orm/reference/prisma-config-reference) file for your project. Then, set up the [migration driver adapter](/orm/reference/prisma-config-reference#adapter-removed) to use `PrismaLibSQL`:

```ts file=prisma.config.ts
import path from 'node:path'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ CLOUDFLARE_D1_TOKEN="F8Cg..."

#### 3. Set up Prisma Config file

Make sure that you have a [`prisma.config.ts`](/orm/reference/prisma-config-reference) file for your project. Then, set up the [migration driver adapter](/orm/reference/prisma-config-reference#adapter) to reference D1:
Make sure that you have a [`prisma.config.ts`](/orm/reference/prisma-config-reference) file for your project. Then, set up the [migration driver adapter](/orm/reference/prisma-config-reference#adapter-removed) to reference D1:

```ts file=prisma.config.ts
import type { PrismaConfig } from 'prisma';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,17 @@ If you want to use external tables, here's the main workflow:
You can specify externally managed tables in your [Prisma Config](/orm/reference/prisma-config-reference) file via the `tables.external` property:

```ts file=prisma.config.ts
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
},
datasource: {
url: env('DATABASE_URL'),
},
// required when using unstable features
experimental: {
// add-next-line
Expand Down Expand Up @@ -88,7 +98,14 @@ If the external table is not referenced by any managed table—that is no manage


```ts file=prisma.config.ts
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
schema: 'prisma/schema.prisma',
datasource: {
url: env('DATABASE_URL'),
},
// required when using unstable features
experimental: {
// add-next-line
Expand All @@ -102,6 +119,7 @@ export default defineConfig({
]
},
migrations: {
path: 'prisma/migrations',
// setup the users table for the shadow database
initShadowDb: `
CREATE TABLE public.users (id SERIAL PRIMARY KEY);
Expand Down Expand Up @@ -168,7 +186,17 @@ CREATE TABLE posts (
Enable use of externally managed tables via the `tables.external` property:

```ts file=prisma.config.ts
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
},
datasource: {
url: env('DATABASE_URL'),
},
experimental: {
// add-next-line
externalTables: true
Expand Down Expand Up @@ -280,12 +308,26 @@ enum role {

Then add a `migrations.initShadowDb` script so Prisma knows about the `users` table during migrations.

```ts
// prisma.config.ts
```ts file=prisma.config.ts
import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
// ...
schema: 'prisma/schema.prisma',
datasource: {
url: env('DATABASE_URL'),
},
experimental: {
externalTables: true
},
tables: {
external: [
"public.users",
]
},
// add-start
migrations: {
path: 'prisma/migrations',
// setup the users table for the shadow database
initShadowDb: `
CREATE TABLE public.users (id SERIAL PRIMARY KEY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A `datasource` block accepts the following fields:
| `provider` | **Yes** | String (`postgresql`, `mysql`, `sqlite`, `sqlserver`, `mongodb`, `cockroachdb`) | Describes which data source connectors to use. |
| `url` | **Yes** | String (URL) | **Deprecated in Prisma ORM v7.** Configure the connection URL in Prisma Config instead: see [`datasource.url`](/orm/reference/prisma-config-reference#datasourceurl). Existing schemas continue to work, but you should migrate to Prisma Config. |
| `shadowDatabaseUrl` | No | String (URL) | **Deprecated in Prisma ORM v7.** Configure the shadow database URL in Prisma Config instead: see [`datasource.shadowDatabaseUrl`](/orm/reference/prisma-config-reference#datasourceshadowdatabaseurl). |
| `directUrl` | No | String (URL) | **Deprecated in Prisma ORM v7.** Configure the direct connection URL in Prisma Config instead: see [`datasource.directUrl`](/orm/reference/prisma-config-reference#datasourcedirecturl). |
| `directUrl` | No | String (URL) | **Deprecated in Prisma ORM v7.** Configure the direct connection URL in Prisma Config instead: see [`datasource.directUrl`](/orm/reference/prisma-config-reference#datasourcedirecturl-removed). |
| `relationMode` | No | String (`foreignKeys`, `prisma`) | Sets whether [referential integrity](/orm/prisma-schema/data-model/relations/relation-mode) is enforced by foreign keys in the database or emulated in the Prisma Client.<br /><br />In preview in versions 3.1.1 and later. The field is named `relationMode` in versions 4.5.0 and later, and was previously named `referentialIntegrity`. |
| `extensions` | No | List of strings (PostgreSQL extension names) | Allows you to [represent PostgreSQL extensions in your schema](/orm/prisma-schema/postgresql-extensions). Available in preview for PostgreSQL only in Prisma ORM versions 4.5.0 and later. |

Expand Down
Loading
Loading