diff --git a/content/100-getting-started/02-prisma-orm/100-quickstart/100-prisma-postgres.mdx b/content/100-getting-started/02-prisma-orm/100-quickstart/100-prisma-postgres.mdx
index c28b1f4514..a5cb227c42 100644
--- a/content/100-getting-started/02-prisma-orm/100-quickstart/100-prisma-postgres.mdx
+++ b/content/100-getting-started/02-prisma-orm/100-quickstart/100-prisma-postgres.mdx
@@ -25,8 +25,8 @@ import NextSteps from '../../_components/_next-steps.mdx'
Install the packages needed for this quickstart:
```terminal
-npm install prisma @types/node --save-dev
-npm install @prisma/client @prisma/adapter-pg dotenv
+npm install prisma @types/node @types/pg --save-dev
+npm install @prisma/client @prisma/adapter-pg pg dotenv
```
Here's what each package does:
@@ -34,6 +34,8 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
+- **`pg`** - The node-postgres database driver
+- **`@types/pg`** - TypeScript type definitions for node-postgres
- **`dotenv`** - Loads environment variables from your `.env` file
## 3. Configure ESM support
diff --git a/content/100-getting-started/02-prisma-orm/100-quickstart/200-sqlite.mdx b/content/100-getting-started/02-prisma-orm/100-quickstart/200-sqlite.mdx
index f04dc1ca00..14f227368c 100644
--- a/content/100-getting-started/02-prisma-orm/100-quickstart/200-sqlite.mdx
+++ b/content/100-getting-started/02-prisma-orm/100-quickstart/200-sqlite.mdx
@@ -27,7 +27,7 @@ In this guide, you will learn how to set up a new TypeScript project from scratc
Install the packages needed for this quickstart:
```terminal
-npm install prisma @types/node --save-dev
+npm install prisma @types/node @types/better-sqlite3 --save-dev
npm install @prisma/client @prisma/adapter-better-sqlite3 dotenv
```
@@ -36,6 +36,7 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-better-sqlite3`** - The SQLite driver adapter that connects Prisma Client to your database
+- **`@types/better-sqlite3`** - TypeScript type definitions for better-sqlite3
- **`dotenv`** - Loads environment variables from your `.env` file
## 3. Configure ESM support
@@ -93,16 +94,13 @@ import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
- migrations: {
- path: 'prisma/migrations',
- },
datasource: {
url: env('DATABASE_URL'),
},
})
```
-Add `dotenv` to `prisma.config.ts` so that Prisma can load environment variables from your `.env` file:
+Add `dotenv` and migrations configuration to `prisma.config.ts`:
```typescript file=prisma.config.ts
// add-start
@@ -112,9 +110,11 @@ import { defineConfig, env } from 'prisma/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
+ // add-start
migrations: {
path: 'prisma/migrations',
},
+ // add-end
datasource: {
url: env('DATABASE_URL'),
},
diff --git a/content/100-getting-started/02-prisma-orm/100-quickstart/300-postgresql.mdx b/content/100-getting-started/02-prisma-orm/100-quickstart/300-postgresql.mdx
index 2d31c50999..bb7b117053 100644
--- a/content/100-getting-started/02-prisma-orm/100-quickstart/300-postgresql.mdx
+++ b/content/100-getting-started/02-prisma-orm/100-quickstart/300-postgresql.mdx
@@ -36,8 +36,8 @@ If you don't already have a PostgreSQL database, follow the quickstart to set up
Install the packages needed for this quickstart:
```terminal
-npm install prisma @types/node --save-dev
-npm install @prisma/client @prisma/adapter-pg dotenv
+npm install prisma @types/node @types/pg --save-dev
+npm install @prisma/client @prisma/adapter-pg pg dotenv
```
Here's what each package does:
@@ -45,6 +45,8 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
+- **`pg`** - The node-postgres database driver
+- **`@types/pg`** - TypeScript type definitions for node-postgres
- **`dotenv`** - Loads environment variables from your `.env` file
## 3. Configure ESM support
diff --git a/content/100-getting-started/02-prisma-orm/100-quickstart/500-sql-server.mdx b/content/100-getting-started/02-prisma-orm/100-quickstart/500-sql-server.mdx
index b7c23969ef..9083dff2f1 100644
--- a/content/100-getting-started/02-prisma-orm/100-quickstart/500-sql-server.mdx
+++ b/content/100-getting-started/02-prisma-orm/100-quickstart/500-sql-server.mdx
@@ -32,7 +32,7 @@ You also need:
Install the packages needed for this quickstart:
```terminal
-npm install prisma @types/node --save-dev
+npm install prisma @types/node @types/mssql --save-dev
npm install @prisma/client @prisma/adapter-mssql dotenv
```
@@ -41,6 +41,7 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-mssql`** - The SQL Server driver adapter that connects Prisma Client to your database
+- **`@types/mssql`** - TypeScript type definitions for mssql
- **`dotenv`** - Loads environment variables from your `.env` file
## 3. Configure ESM support
diff --git a/content/100-getting-started/02-prisma-orm/100-quickstart/700-cockroachdb.mdx b/content/100-getting-started/02-prisma-orm/100-quickstart/700-cockroachdb.mdx
index f227598dc7..601a6a775b 100644
--- a/content/100-getting-started/02-prisma-orm/100-quickstart/700-cockroachdb.mdx
+++ b/content/100-getting-started/02-prisma-orm/100-quickstart/700-cockroachdb.mdx
@@ -30,8 +30,8 @@ You also need:
Install the packages needed for this quickstart:
```terminal
-npm install prisma @types/node --save-dev
-npm install @prisma/client @prisma/adapter-pg dotenv
+npm install prisma @types/node @types/pg --save-dev
+npm install @prisma/client @prisma/adapter-pg pg dotenv
```
Here's what each package does:
@@ -39,6 +39,8 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma migrate`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database (CockroachDB is PostgreSQL-compatible)
+- **`pg`** - The node-postgres database driver
+- **`@types/pg`** - TypeScript type definitions for node-postgres
- **`dotenv`** - Loads environment variables from your `.env` file
## 3. Configure ESM support
diff --git a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/100-prisma-postgres.mdx b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/100-prisma-postgres.mdx
index 07b5149aaf..f415afdace 100644
--- a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/100-prisma-postgres.mdx
+++ b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/100-prisma-postgres.mdx
@@ -20,8 +20,8 @@ import NextSteps from '../../_components/_next-steps.mdx'
Navigate to your existing project directory and install the required dependencies:
```terminal
-npm install prisma @types/node --save-dev
-npm install @prisma/client @prisma/adapter-pg dotenv
+npm install prisma @types/node @types/pg --save-dev
+npm install @prisma/client @prisma/adapter-pg pg dotenv
```
Here's what each package does:
@@ -29,6 +29,8 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
+- **`pg`** - The node-postgres database driver
+- **`@types/pg`** - TypeScript type definitions for node-postgres
- **`dotenv`** - Loads environment variables from your `.env` file
## 2. Initialize Prisma ORM
diff --git a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/200-sqlite.mdx b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/200-sqlite.mdx
index 9109da70fe..4829c9be51 100644
--- a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/200-sqlite.mdx
+++ b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/200-sqlite.mdx
@@ -20,7 +20,7 @@ import NextSteps from '../../_components/_next-steps.mdx'
Navigate to your existing project directory and install the required dependencies:
```terminal
-npm install prisma @types/node --save-dev
+npm install prisma @types/node @types/better-sqlite3 --save-dev
npm install @prisma/client @prisma/adapter-better-sqlite3 dotenv
```
@@ -29,6 +29,7 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-better-sqlite3`** - The SQLite driver adapter that connects Prisma Client to your database
+- **`@types/better-sqlite3`** - TypeScript type definitions for better-sqlite3
- **`dotenv`** - Loads environment variables from your `.env` file
## 2. Initialize Prisma ORM
diff --git a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/300-postgresql.mdx b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/300-postgresql.mdx
index 4c9160e611..025304d8ff 100644
--- a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/300-postgresql.mdx
+++ b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/300-postgresql.mdx
@@ -20,8 +20,8 @@ import NextSteps from '../../_components/_next-steps.mdx'
Navigate to your existing project directory and install the required dependencies:
```terminal
-npm install prisma @types/node --save-dev
-npm install @prisma/client @prisma/adapter-pg dotenv
+npm install prisma @types/node @types/pg --save-dev
+npm install @prisma/client @prisma/adapter-pg pg dotenv
```
Here's what each package does:
@@ -29,6 +29,8 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database
+- **`pg`** - The node-postgres database driver
+- **`@types/pg`** - TypeScript type definitions for node-postgres
- **`dotenv`** - Loads environment variables from your `.env` file
## 2. Initialize Prisma ORM
diff --git a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/500-sql-server.mdx b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/500-sql-server.mdx
index 0ae3bd823d..31dfe9f393 100644
--- a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/500-sql-server.mdx
+++ b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/500-sql-server.mdx
@@ -20,7 +20,7 @@ import NextSteps from '../../_components/_next-steps.mdx'
Navigate to your existing project directory and install the required dependencies:
```terminal
-npm install prisma @types/node --save-dev
+npm install prisma @types/node @types/mssql --save-dev
npm install @prisma/client @prisma/adapter-mssql dotenv
```
@@ -30,6 +30,7 @@ Here's what each package does:
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-mssql`** - The SQL Server driver adapter that connects Prisma Client to your database
- **`dotenv`** - Loads environment variables from your `.env` file
+- **`@types/mssql`** - TypeScript type definitions for mssql
## 2. Initialize Prisma ORM
diff --git a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/700-cockroachdb.mdx b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/700-cockroachdb.mdx
index 7908afe4a6..5b878d723c 100644
--- a/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/700-cockroachdb.mdx
+++ b/content/100-getting-started/02-prisma-orm/200-add-to-existing-project/700-cockroachdb.mdx
@@ -20,8 +20,8 @@ import NextSteps from '../../_components/_next-steps.mdx'
Navigate to your existing project directory and install the required dependencies:
```terminal
-npm install prisma @types/node --save-dev
-npm install @prisma/client @prisma/adapter-pg dotenv
+npm install prisma @types/node @types/pg --save-dev
+npm install @prisma/client @prisma/adapter-pg pg dotenv
```
Here's what each package does:
@@ -29,6 +29,8 @@ Here's what each package does:
- **`prisma`** - The Prisma CLI for running commands like `prisma init`, `prisma db pull`, and `prisma generate`
- **`@prisma/client`** - The Prisma Client library for querying your database
- **`@prisma/adapter-pg`** - The [`node-postgres` driver adapter](/orm/overview/databases/postgresql#using-the-node-postgres-driver) that connects Prisma Client to your database (CockroachDB is PostgreSQL-compatible)
+- **`pg`** - The node-postgres database driver
+- **`@types/pg`** - TypeScript type definitions for node-postgres
- **`dotenv`** - Loads environment variables from your `.env` file
## 2. Initialize Prisma ORM
diff --git a/content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx b/content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx
index 9d3e6275ff..8c8c91ccb6 100644
--- a/content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx
+++ b/content/100-getting-started/03-prisma-postgres/100-from-the-cli.mdx
@@ -31,30 +31,57 @@ npx prisma@latest init --db
```code no-copy wrap
-Success! Your Prisma Postgres database is ready ✅
+✓ Select an authentication method Google
+Authenticating to Prisma Platform via browser.
-We created an initial schema.prisma file and a .env file with your DATABASE_URL environment variable already set.
+Visit the following URL in your browser to authenticate:
+https://console.prisma.io/auth/cli?state=eyJjb6ll...
+
+Successfully authenticated as jon@doe.com.
+Let's set up your Prisma Postgres database!
+✓ Select your region: ap-southeast-1 - Asia Pacific (Singapore)
+✓ Enter a project name: My Prisma Project
+✓ Success! Your Prisma Postgres database is ready ✅
+
+We found an existing schema.prisma file in your current project directory.
+
+--- Database URL ---
+
+Connect Prisma ORM to your Prisma Postgres database with this URL:
--- Next steps ---
Go to https://pris.ly/ppg-init for detailed instructions.
-1. Define your database schema
-Open the schema.prisma file and define your first models. Check the docs if you need inspiration: https://pris.ly/ppg-init
+1. Install the Postgres adapter
+npm install @prisma/adapter-pg
+
+...and add it to your Prisma Client instance:
+
+import { PrismaClient } from "./generated/prisma/client";
+import { PrismaPg } from "@prisma/adapter-pg";
+
+const connectionString = `${process.env.DATABASE_URL}`;
+
+const adapter = new PrismaPg({ connectionString });
+const prisma = new PrismaClient({ adapter });
2. Apply migrations
Run the following command to create and apply a migration:
-npx prisma migrate dev --name init
+npx prisma migrate dev
3. Manage your data
-View and edit your data locally by running this command:
+View and edit your data locally by running this command:
npx prisma studio
-... or online in Console:
-https://console.prisma.io/cliwxim5p005xqh0g3mvqpyak/cm6kw97t801ijzhvfwz4a0my3/cm6kw97ta01ikzhvf965vresv/studio
+...or online in Console:
+https://console.prisma.io/$path
4. Send queries from your app
-To access your database from a JavaScript/TypeScript app, you need to use Prisma ORM. Go here for step-by-step instructions: https://pris.ly/ppg-init
+If you already have an existing app with Prisma ORM, you can now run it and it will send queries against your newly created Prisma Postgres instance.
+
+5. Learn more
+For more info, visit the Prisma Postgres docs: https://pris.ly/ppg-docs
```
diff --git a/content/100-getting-started/03-prisma-postgres/115-import-from-existing-database-mysql.mdx b/content/100-getting-started/03-prisma-postgres/115-import-from-existing-database-mysql.mdx
index 0d009ba206..97bfeade5e 100644
--- a/content/100-getting-started/03-prisma-postgres/115-import-from-existing-database-mysql.mdx
+++ b/content/100-getting-started/03-prisma-postgres/115-import-from-existing-database-mysql.mdx
@@ -189,7 +189,6 @@ datasource db {
// add-start
provider = "postgres"
// add-end
- url = env("DATABASE_URL")
}
```
diff --git a/content/200-orm/050-overview/500-databases/200-database-drivers.mdx b/content/200-orm/050-overview/500-databases/200-database-drivers.mdx
index 822925c2ad..c89546e390 100644
--- a/content/200-orm/050-overview/500-databases/200-database-drivers.mdx
+++ b/content/200-orm/050-overview/500-databases/200-database-drivers.mdx
@@ -12,19 +12,18 @@ One of Prisma Client's components is the [Query Engine](/orm/more/under-the-hood
:::note
-As of [v6.15.0](https://pris.ly/release/6.16.0), Prisma ORM can be used without Rust engines in production applications. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine).
+As of Prisma ORM 7, the query compiler (client engine) is the default, which means Prisma Client is generated without a Rust-based query engine binary. This provides better performance and developer experience. Learn more [here](/orm/prisma-client/setup-and-configuration/no-rust-engine).
-**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
+In Prisma ORM 7, the default generator configuration is:
```prisma
generator client {
- provider = "prisma-client"
- output = "../src/generated/prisma"
- engineType = "client" // no Rust engine
+ provider = "prisma-client"
+ output = "../generated/prisma"
}
```
-Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required if you want to use Prisma ORM without Rust engines.
+Note that [driver adapters](/orm/overview/databases/database-drivers#driver-adapters) are required when using the query compiler.
You can [read about the performance and DX improvements](https://www.prisma.io/blog/prisma-orm-without-rust-latest-performance-benchmarks) of this change on our blog.
@@ -120,7 +119,7 @@ As of the 6.6.0 release, you instantiate the driver adapter _directly_ with the
```typescript
import { PrismaLibSQL } from '@prisma/adapter-libsql'
-import { PrismaClient } from '../prisma/prisma-client'
+import { PrismaClient } from '../generated/prisma/client'
const adapter = new PrismaLibSQL({
url: env.LIBSQL_DATABASE_URL,
@@ -130,17 +129,18 @@ const adapter = new PrismaLibSQL({
const prisma = new PrismaClient({ adapter })
```
-### Driver adapters don't read the connection string from the Prisma schema
+### Driver adapters and database connection configuration
-When using Prisma ORM's built-in drivers, the connection string is read from the `url` field of the `datasource` block in your Prisma schema.
+In Prisma ORM 7, the database connection URL is configured in [`prisma.config.ts`](/orm/reference/prisma-config-reference). However, when using a driver adapter, the connection string needs to be provided in your _application code_ when the driver adapter is set up initially.
-On the other hand, when using a driver adapter, the connection string needs to be provided in your _application code_ when the driver adapter is set up initially. Here is how this is done for the `pg` driver and the `@prisma/adapter-pg` adapter:
+Here is how this is done for the `pg` driver and the `@prisma/adapter-pg` adapter:
```ts
-import { PrismaClient } from '../prisma/generated/client'
+import 'dotenv/config'
+import { PrismaClient } from '../generated/prisma/client'
import { PrismaPg } from '@prisma/adapter-pg'
-const adapter = new PrismaPg({ connectionString: env.DATABASE_URL })
+const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
```
@@ -148,9 +148,9 @@ See the docs for the driver adapter you're using for concrete setup instructions
### Driver adapters and custom output paths
-Since Prisma 5.9.0, when using the driver adapters Preview feature along with a [custom output path for Prisma Client](/orm/prisma-client/setup-and-configuration/generating-prisma-client#using-a-custom-output-path), you cannot reference Prisma Client using a relative path.
+In Prisma ORM 7, the recommended approach is to use a custom output path for Prisma Client. The default output path is `../generated/prisma`.
-Let's assume you had `output` in your Prisma schema set to `../src/generated/client`:
+Let's assume you have `output` in your Prisma schema set to `../generated/prisma`:
```prisma
generator client {
@@ -159,23 +159,22 @@ generator client {
}
```
-What you should _not_ do is reference that path relatively:
+You can reference Prisma Client using a relative path from your application code:
-```ts no-copy
-// what not to do!
-import { PrismaClient } from './src/generated/client'
+```ts
+import { PrismaClient } from '../generated/prisma/client'
const client = new PrismaClient()
```
-Instead, you will need to use a linked dependency.
+Alternatively, you can use a linked dependency for cleaner imports.
```terminal
-npm add db@./src/generated/client
+npm add db@./generated/prisma
```
@@ -183,7 +182,7 @@ npm add db@./src/generated/client
```terminal
-pnpm add db@link:./src/generated/client
+pnpm add db@link:./generated/prisma
```
@@ -191,7 +190,7 @@ pnpm add db@link:./src/generated/client
```terminal
-yarn add db@link:./src/generated/client
+yarn add db@link:./generated/prisma
```
diff --git a/content/200-orm/050-overview/500-databases/300-postgresql.mdx b/content/200-orm/050-overview/500-databases/300-postgresql.mdx
index 52ead2eb8d..98fb4750d2 100644
--- a/content/200-orm/050-overview/500-databases/300-postgresql.mdx
+++ b/content/200-orm/050-overview/500-databases/300-postgresql.mdx
@@ -28,11 +28,13 @@ datasource db {
}
```
-The database connection URL is configured in `prisma.config.ts`:
+The `datasource` block specifies the `postgresql` data source connector.
-```ts file=prisma.config.ts
-import 'dotenv/config'
+In Prisma ORM 7, the database connection URL is configured in [`prisma.config.ts`](/orm/reference/prisma-config-reference):
+
+```typescript file=prisma.config.ts
import { defineConfig, env } from 'prisma/config'
+import 'dotenv/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
@@ -42,16 +44,7 @@ export default defineConfig({
})
```
-:::info
-
-When using Prisma CLI commands, environment variables are not automatically loaded. You'll need to use a package like `dotenv` to load environment variables from a `.env` file, or ensure your environment variables are set in your shell.
-
-:::
-
-The fields passed to the `datasource` block are:
-
-- `provider`: Specifies the `postgresql` data source connector.
-- The `url` field is configured in `prisma.config.ts` and specifies the [connection URL](#connection-url) for the PostgreSQL database server.
+This configuration uses an [environment variable](/orm/prisma-schema/overview#accessing-environment-variables-from-the-schema) to provide the database connection URL.
## Using the `node-postgres` driver
@@ -74,13 +67,14 @@ npm install @prisma/adapter-pg
Now, when you instantiate Prisma Client, you need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
```ts
+import 'dotenv/config'
import { PrismaPg } from '@prisma/adapter-pg'
-import { PrismaClient } from '../prisma/generated/client'
+import { PrismaClient } from '../generated/prisma/client'
const connectionString = `${process.env.DATABASE_URL}`
-const adapter = new PrismaPg({ connectionString });
-const prisma = new PrismaClient({ adapter });
+const adapter = new PrismaPg({ connectionString })
+const prisma = new PrismaClient({ adapter })
```
Notice that this code requires the `DATABASE_URL` environment variable to be set to your PostgreSQL connection string. You can learn more about the connection string below.
diff --git a/content/200-orm/050-overview/500-databases/400-mysql.mdx b/content/200-orm/050-overview/500-databases/400-mysql.mdx
index 18e7214e5f..60b61c9bcb 100644
--- a/content/200-orm/050-overview/500-databases/400-mysql.mdx
+++ b/content/200-orm/050-overview/500-databases/400-mysql.mdx
@@ -19,11 +19,13 @@ datasource db {
}
```
-The database connection URL is configured in `prisma.config.ts`:
+The `datasource` block specifies the `mysql` data source connector, which is used for both MySQL and MariaDB.
-```ts file=prisma.config.ts
-import 'dotenv/config'
+In Prisma ORM 7, the database connection URL is configured in [`prisma.config.ts`](/orm/reference/prisma-config-reference):
+
+```typescript file=prisma.config.ts
import { defineConfig, env } from 'prisma/config'
+import 'dotenv/config'
export default defineConfig({
schema: 'prisma/schema.prisma',
@@ -33,16 +35,7 @@ export default defineConfig({
})
```
-:::info
-
-When using Prisma CLI commands, environment variables are not automatically loaded. You'll need to use a package like `dotenv` to load environment variables from a `.env` file, or ensure your environment variables are set in your shell.
-
-:::
-
-The fields passed to the `datasource` block are:
-
-- `provider`: Specifies the `mysql` data source connector, which is used both for MySQL and MariaDB.
-- The `url` field is configured in `prisma.config.ts` and specifies the [connection URL](#connection-url) for the MySQL database server.
+This configuration uses an [environment variable](/orm/prisma-schema/overview#accessing-environment-variables-from-the-schema) to provide the database connection URL.
## Using the `mariadb` driver
@@ -65,15 +58,16 @@ npm install @prisma/adapter-mariadb
Now, when you instantiate Prisma Client, you need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
```ts
-import { PrismaMariaDb } from '@prisma/adapter-mariadb';
-import { PrismaClient } from './generated/prisma';
+import 'dotenv/config'
+import { PrismaMariaDb } from '@prisma/adapter-mariadb'
+import { PrismaClient } from '../generated/prisma/client'
const adapter = new PrismaMariaDb({
host: "localhost",
port: 3306,
connectionLimit: 5
-});
-const prisma = new PrismaClient({ adapter });
+})
+const prisma = new PrismaClient({ adapter })
```
## Connection details
diff --git a/content/200-orm/050-overview/500-databases/500-sqlite.mdx b/content/200-orm/050-overview/500-databases/500-sqlite.mdx
index 1e27d3911b..6235b5d18c 100644
--- a/content/200-orm/050-overview/500-databases/500-sqlite.mdx
+++ b/content/200-orm/050-overview/500-databases/500-sqlite.mdx
@@ -16,14 +16,25 @@ To connect to a SQLite database file, you need to configure a [`datasource`](/or
```prisma file=schema.prisma
datasource db {
provider = "sqlite"
- url = "file:./dev.db"
}
```
-The fields passed to the `datasource` block are:
+The `datasource` block specifies the `sqlite` data source connector.
-- `provider`: Specifies the `sqlite` data source connector.
-- `url`: Specifies the [connection URL](/orm/reference/connection-urls) for the SQLite database. The connection URL always starts with the prefix `file:` and then contains a file path pointing to the SQLite database file. In this case, the file is located in the same directory and called `dev.db`.
+In Prisma ORM 7, the database connection URL is configured in [`prisma.config.ts`](/orm/reference/prisma-config-reference):
+
+```typescript file=prisma.config.ts
+import { defineConfig } from 'prisma/config'
+
+export default defineConfig({
+ schema: 'prisma/schema.prisma',
+ datasource: {
+ url: 'file:./dev.db',
+ },
+})
+```
+
+The connection URL always starts with the prefix `file:` and then contains a file path pointing to the SQLite database file. In this example, the file is located in the same directory and called `dev.db`.
## Using the `better-sqlite3` driver
@@ -51,8 +62,8 @@ import { PrismaClient } from './generated/prisma';
const adapter = new PrismaBetterSqlite3({
url: "file:./prisma/dev.db"
-});
-const prisma = new PrismaClient({ adapter });
+})
+const prisma = new PrismaClient({ adapter })
```
### 3. Configure timestamp format for backward compatibility
@@ -71,8 +82,8 @@ const adapter = new PrismaBetterSqlite3({
url: "file:./prisma/dev.db"
}, {
timestampFormat: 'unixepoch-ms'
-});
-const prisma = new PrismaClient({ adapter });
+})
+const prisma = new PrismaClient({ adapter })
```
:::info
@@ -138,29 +149,26 @@ try migrating the 'int' column type to BIGINT
### Connection URL
-The connection URL of a SQLite connector points to a file on your file system. For example, the following two paths are equivalent because the `.db` is in the same directory:
+The connection URL of a SQLite connector points to a file on your file system and is configured in `prisma.config.ts`. For example, the following two paths are equivalent because the `.db` is in the same directory:
-```prisma file=schema.prisma
-datasource db {
- provider = "sqlite"
- url = "file:./dev.db"
+```typescript file=prisma.config.ts
+datasource: {
+ url: 'file:./dev.db',
}
```
is the same as:
-```prisma file=schema.prisma
-datasource db {
- provider = "sqlite"
- url = "file:dev.db"
+```typescript file=prisma.config.ts
+datasource: {
+ url: 'file:dev.db',
}
```
You can also target files from the root or any other place in your file system:
-```prisma file=schema.prisma
-datasource db {
- provider = "sqlite"
- url = "file:/Users/janedoe/dev.db"
+```typescript file=prisma.config.ts
+datasource: {
+ url: 'file:/Users/janedoe/dev.db',
}
```
diff --git a/content/200-orm/050-overview/500-databases/800-sql-server/index.mdx b/content/200-orm/050-overview/500-databases/800-sql-server/index.mdx
index 86e02b41ac..aac61feff2 100644
--- a/content/200-orm/050-overview/500-databases/800-sql-server/index.mdx
+++ b/content/200-orm/050-overview/500-databases/800-sql-server/index.mdx
@@ -65,6 +65,7 @@ npm install @prisma/adapter-mssql
Now, when you instantiate Prisma Client, you need to pass an instance of Prisma ORM's driver adapter to the `PrismaClient` constructor:
```ts
+import 'dotenv/config'
import { PrismaMssql } from '@prisma/adapter-mssql'
import { PrismaClient } from '../prisma/generated/client'
diff --git a/content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx b/content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx
index daffbf41a1..ee1d12b671 100644
--- a/content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx
+++ b/content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx
@@ -530,7 +530,7 @@ const result = await prisma.user.create({
There are two ways to create or update a single record and multiple related records - for example, a user with multiple posts:
-- Use a nested [`create`](/orm/reference/prisma-client-reference#create-1) query
+- Use a nested [`create`](/orm/reference/prisma-client-reference#create) query
- Use a nested [`createMany`](/orm/reference/prisma-client-reference#createmany-1) query
In most cases, a nested `create` will be preferable unless the [`skipDuplicates` query option](/orm/reference/prisma-client-reference#nested-createmany-options) is required. Here's a quick table describing the differences between the two options:
@@ -544,7 +544,7 @@ In most cases, a nested `create` will be preferable unless the [`skipDuplicates`
#### Using nested `create`
-The following query uses nested [`create`](/orm/reference/prisma-client-reference#create-1) to create:
+The following query uses nested [`create`](/orm/reference/prisma-client-reference#create) to create:
- One user
- Two posts
@@ -640,7 +640,7 @@ Here's a visual representation of how a nested create operation can write to sev
#### Using nested `createMany`
-The following query uses a nested [`createMany`](/orm/reference/prisma-client-reference#create-1) to create:
+The following query uses a nested [`createMany`](/orm/reference/prisma-client-reference#create) to create:
- One user
- Two posts
diff --git a/content/200-orm/500-reference/050-prisma-client-reference.mdx b/content/200-orm/500-reference/050-prisma-client-reference.mdx
index f92eadde2b..8ea2c2473f 100644
--- a/content/200-orm/500-reference/050-prisma-client-reference.mdx
+++ b/content/200-orm/500-reference/050-prisma-client-reference.mdx
@@ -825,7 +825,7 @@ const user = await prisma.user.findMany({
#### Remarks
-- You can also perform a nested [`create`](#create-1) - for example, add a `User` and two `Post` records at the same time.
+- You can also perform a nested [`create`](#create) - for example, add a `User` and two `Post` records at the same time.
#### Examples
diff --git a/content/200-orm/500-reference/200-prisma-cli-reference.mdx b/content/200-orm/500-reference/200-prisma-cli-reference.mdx
index 6f636d254c..aac2536e20 100644
--- a/content/200-orm/500-reference/200-prisma-cli-reference.mdx
+++ b/content/200-orm/500-reference/200-prisma-cli-reference.mdx
@@ -155,17 +155,27 @@ prisma init
```code no-copy wrap
-✔ Your Prisma schema was created at prisma/schema.prisma.
- You can now open it in your favorite editor.
+npx prisma init
-Next steps:
-1. Set the DATABASE_URL in the .env file to point to your existing database. If your database has no tables yet, read https://pris.ly/d/getting-started
-2. Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql, sqlite, sqlserver, mongodb or cockroachdb.
-3. Run prisma db pull to turn your database schema into a Prisma schema.
-4. Run prisma generate to generate Prisma Client. You can then start querying your database.
+Initialized Prisma in your project
-More information in our documentation:
-https://pris.ly/d/getting-started
+ prisma/
+ schema.prisma
+ prisma.config.ts
+
+Next, choose how you want to set up your database:
+
+CONNECT EXISTING DATABASE:
+ 1. Configure your DATABASE_URL in `prisma.config.ts`
+ 2. Run `npx prisma db pull` to introspect your database.
+
+CREATE NEW DATABASE:
+ Local: npx prisma dev (runs Postgres locally in your terminal)
+ Cloud: npx create-db (creates a free Prisma Postgres database)
+
+ Then, define your models in `prisma/schema.prisma` and run `npx prisma migrate dev` to apply your schema.
+
+Learn more: https://pris.ly/getting-started
```
@@ -184,10 +194,76 @@ The command output contains helpful information on how to use the generated file
**Run `prisma init --db`**
+
+
+
+
```terminal
prisma init --db
```
+
+
+
+
+```code no-copy wrap
+✓ Select an authentication method Google
+Authenticating to Prisma Platform via browser.
+
+Visit the following URL in your browser to authenticate:
+https://console.prisma.io/auth/cli?state=eyJjb6ll...
+
+Successfully authenticated as amanyoyoyo@gmail.com.
+Let's set up your Prisma Postgres database!
+✓ Select your region: ap-southeast-1 - Asia Pacific (Singapore)
+✓ Enter a project name: My Prisma Project
+✓ Success! Your Prisma Postgres database is ready ✅
+
+We found an existing schema.prisma file in your current project directory.
+
+--- Database URL ---
+
+Connect Prisma ORM to your Prisma Postgres database with this URL:
+
+--- Next steps ---
+
+Go to https://pris.ly/ppg-init for detailed instructions.
+
+1. Install the Postgres adapter
+npm install @prisma/adapter-pg
+
+...and add it to your Prisma Client instance:
+
+import { PrismaClient } from "./generated/prisma/client";
+import { PrismaPg } from "@prisma/adapter-pg";
+
+const connectionString = `${process.env.DATABASE_URL}`;
+
+const adapter = new PrismaPg({ connectionString });
+const prisma = new PrismaClient({ adapter });
+
+2. Apply migrations
+Run the following command to create and apply a migration:
+npx prisma migrate dev
+
+3. Manage your data
+View and edit your data locally by running this command:
+npx prisma studio
+
+...or online in Console:
+https://console.prisma.io/cmhyn0uwl0q6903foel16ff31/cmhyn143t074tyLfoezs684ag/cmhyn143t074uylfon8hfre5z/studio
+
+4. Send queries from your app
+If you already have an existing app with Prisma ORM, you can now run it and it will send queries against your newly created Prisma Postgres instance.
+
+5. Learn more
+For more info, visit the Prisma Postgres docs: https://pris.ly/ppg-docs
+```
+
+
+
+
+
The command creates a new [Prisma Postgres](https://www.prisma.io/postgres) instance. Note that it requires you to be authenticated with the [PDP Console](https://console.prisma.io), If you run it for the first time without being authenticated, the command will open the browser for you to log into Console.
**Run `prisma init --prompt "Simple habit tracker application"`**
@@ -219,7 +295,6 @@ datasource db {
generator client {
provider = "prisma-client"
- output = "./generated"
previewFeatures = ["metrics"]
}
```
@@ -247,7 +322,6 @@ datasource db {
generator client {
provider = "prisma-client"
- output = "./generated"
previewFeatures = ["views", "metrics"]
}
```
@@ -276,6 +350,26 @@ datasource db {
}
```
+**`prisma.config.ts`**
+
+A TypeScript configuration file for Prisma that defines your datasource URL and other settings:
+
+```typescript
+import { defineConfig, env } from 'prisma/config'
+
+export default defineConfig({
+ schema: 'prisma/schema.prisma',
+ migrations: {
+ path: 'prisma/migrations',
+ },
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+})
+```
+
+See the [Prisma Config reference](/orm/reference/prisma-config-reference) for more details.
+
**`.env`**
A file to define environment variables for your project:
@@ -287,7 +381,7 @@ A file to define environment variables for your project:
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
-DATABASE_URL="file:./dev.db"
+DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
```
**`.gitignore`**
@@ -326,10 +420,28 @@ datasource db {
generator client {
provider = "prisma-client"
- output = "./generated"
+ output = "../generated/prisma"
}
```
+**`prisma.config.ts`**
+
+A TypeScript configuration file for Prisma with the custom URL:
+
+```typescript
+import { defineConfig, env } from 'prisma/config'
+
+export default defineConfig({
+ schema: 'prisma/schema.prisma',
+ migrations: {
+ path: 'prisma/migrations',
+ },
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+})
+```
+
**`.env`**
A file to define environment variables for your project:
@@ -828,17 +940,37 @@ Introspection with the `db pull` command on the [MongoDB connector](/orm/overvie
#### Prerequisites
-Before using the `db pull` command, you must define a valid [`datasource`](/orm/prisma-schema/overview/data-sources) within your `schema.prisma` file.
+Before using the `db pull` command, you must configure your database connection in your `prisma.config.ts` file.
-For example, the following `datasource` defines a SQLite database file within the current directory:
+For example:
+
+```prisma file=schema.prisma
+generator client {
+ provider = "prisma-client"
+ output = "../generated/prisma"
+}
-```prisma
datasource db {
provider = "sqlite"
- url = "file:my-database.db"
}
```
+```typescript file=prisma.config.ts
+import { defineConfig, env } from 'prisma/config'
+
+export default defineConfig({
+ schema: 'prisma/schema.prisma',
+ migrations: {
+ path: 'prisma/migrations',
+ },
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+})
+```
+
+
+
#### Options
| Option | Required | Description | Default |
@@ -972,17 +1104,35 @@ See also:
#### Prerequisites
-Before using the `db push` command, you must define a valid [datasource](/orm/prisma-schema/overview/data-sources) within your `schema.prisma` file.
+Before using the `db push` command, you must configure your database connection in your `prisma.config.ts` file.
-For example, the following `datasource` defines a SQLite database file within the current directory:
+For example:
+
+```prisma file=schema.prisma
+generator client {
+ provider = "prisma-client"
+ output = "../generated/prisma"
+}
-```prisma
datasource db {
provider = "sqlite"
- url = "file:my-database.db"
}
```
+```typescript file=prisma.config.ts
+import { defineConfig, env } from 'prisma/config'
+
+export default defineConfig({
+ schema: 'prisma/schema.prisma',
+ migrations: {
+ path: 'prisma/migrations',
+ },
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+})
+```
+
#### Options
| Options | Required | Description |
@@ -1066,17 +1216,37 @@ See also:
#### Prerequisites
-Before using the `db execute` command, if you do not use the `--url` option you must define a valid [`datasource`](/orm/prisma-schema/overview/data-sources) within your `schema.prisma` file.
+Before using the `db execute` command, if you do not use the `--url` option you must configure your database connection in your `prisma.config.ts` file.
-For example, the following `datasource` defines a SQLite database file within the current directory:
+For example:
+
+```prisma file=schema.prisma
+generator client {
+ provider = "prisma-client"
+ output = "../generated/prisma"
+}
-```prisma
datasource db {
provider = "sqlite"
- url = "file:my-database.db"
}
```
+This how your `prisma.config.ts` file should look like:
+
+```typescript file=prisma.config.ts
+import { defineConfig, env } from 'prisma/config'
+
+export default defineConfig({
+ schema: 'prisma/schema.prisma',
+ migrations: {
+ path: 'prisma/migrations',
+ },
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+})
+```
+
#### Options
One of the following data source inputs is required:
@@ -1414,17 +1584,35 @@ See also:
#### Prerequisites
-Before using the `migrate diff` command, if you are using the `--from-schema-datasource` or `--to-schema-datasource` you must define a valid [`datasource`](/orm/prisma-schema/overview/data-sources) within your `schema.prisma` file.
+Before using the `migrate diff` command, if you are using the `--from-schema-datasource` or `--to-schema-datasource` you must configure your database connection in your `prisma.config.ts` file.
-For example, the following `datasource` defines a SQLite database file within the current directory:
+For example:
+
+```prisma file=schema.prisma
+generator client {
+ provider = "prisma-client"
+ output = "../generated/prisma"
+}
-```prisma
datasource db {
provider = "sqlite"
- url = "file:my-database.db"
}
```
+```typescript file=prisma.config.ts
+import { defineConfig, env } from 'prisma/config'
+
+export default defineConfig({
+ schema: 'prisma/schema.prisma',
+ migrations: {
+ path: 'prisma/migrations',
+ },
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+})
+```
+
#### Options
One of the following `--from-...` options is required:
@@ -1521,17 +1709,35 @@ The `studio` command allows you to interact with and manage your data interactiv
#### Prerequisites
-Before using the `studio` command, you must define a valid [`datasource`](/orm/prisma-schema/overview/data-sources) within your `schema.prisma` file.
+Before using the `studio` command, you must configure your database connection in your `prisma.config.ts` file.
-For example, the following `datasource` defines a SQLite database file within the current directory:
+For example:
+
+```prisma file=schema.prisma
+generator client {
+ provider = "prisma-client"
+ output = "../generated/prisma"
+}
-```prisma
datasource db {
provider = "sqlite"
- url = "file:my-database.db"
}
```
+```typescript file=prisma.config.ts
+import { defineConfig, env } from 'prisma/config'
+
+export default defineConfig({
+ schema: 'prisma/schema.prisma',
+ migrations: {
+ path: 'prisma/migrations',
+ },
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+})
+```
+
#### Options
The `studio` command recognizes the following options:
diff --git a/content/250-postgres/350-integrations/100-netlify.mdx b/content/250-postgres/350-integrations/100-netlify.mdx
index 9cbd243363..06a1353719 100644
--- a/content/250-postgres/350-integrations/100-netlify.mdx
+++ b/content/250-postgres/350-integrations/100-netlify.mdx
@@ -120,7 +120,7 @@ In this section, you are going to add Prisma Postgres to the starter project _on
```terminal
npm install prisma --save-dev
```
-1. Initialize Prisma ORM to create Prisma schema and `.env` file:
+1. Initialize Prisma ORM to create Prisma schema, config and `.env` file:
```terminal
npx prisma init
```
diff --git a/content/600-about/30-docs-components/01-mdx-examples.mdx b/content/600-about/30-docs-components/01-mdx-examples.mdx
index 4496424195..2a18475965 100644
--- a/content/600-about/30-docs-components/01-mdx-examples.mdx
+++ b/content/600-about/30-docs-components/01-mdx-examples.mdx
@@ -341,17 +341,25 @@ yarn run v1.22.0
warning package.json: No license field
$ /Users/janedoe/Desktop/tsdf/node_modules/.bin/prisma init
-✔ Your Prisma schema was created at prisma/schema.prisma.
- You can now open it in your favorite editor.
+Initialized Prisma in your project
-Next steps:
-1. Set the DATABASE_URL in the .env file to point to your existing database. If your database has no tables yet, read https://pris.ly/d/getting-started.
-2. Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql or sqlite.
-3. Run `prisma db pull` to introspect your database schema and update the Prisma schema data models accordingly.
-4. Run `prisma generate` to install Prisma Client. You can then start querying your database.
+ prisma/
+ schema.prisma
+ prisma.config.ts
-More information in our documentation:
-https://pris.ly/d/getting-started
+Next, choose how you want to set up your database:
+
+CONNECT EXISTING DATABASE:
+ 1. Configure your DATABASE_URL in `prisma.config.ts`
+ 2. Run `npx prisma db pull` to introspect your database.
+
+CREATE NEW DATABASE:
+ Local: npx prisma dev (runs Postgres locally in your terminal)
+ Cloud: npx create-db (creates a free Prisma Postgres database)
+
+ Then, define your models in `prisma/schema.prisma` and run `npx prisma migrate dev` to apply your schema.
+
+Learn more: https://pris.ly/getting-started
```
@@ -379,17 +387,25 @@ yarn run v1.22.0
warning package.json: No license field
$ /Users/janedoe/Desktop/tsdf/node_modules/.bin/prisma init
-✔ Your Prisma schema was created at prisma/schema.prisma.
- You can now open it in your favorite editor.
+Initialized Prisma in your project
+
+ prisma/
+ schema.prisma
+ prisma.config.ts
-Next steps:
-1. Set the DATABASE_URL in the .env file to point to your existing database. If your database has no tables yet, read https://pris.ly/d/getting-started.
-2. Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql or sqlite.
-3. Run `prisma db pull` to introspect your database schema and update the Prisma schema data models accordingly.
-4. Run `prisma generate` to install Prisma Client. You can then start querying your database.
+Next, choose how you want to set up your database:
-More information in our documentation:
-https://pris.ly/d/getting-started
+CONNECT EXISTING DATABASE:
+ 1. Configure your DATABASE_URL in `prisma.config.ts`
+ 2. Run `npx prisma db pull` to introspect your database.
+
+CREATE NEW DATABASE:
+ Local: npx prisma dev (runs Postgres locally in your terminal)
+ Cloud: npx create-db (creates a free Prisma Postgres database)
+
+ Then, define your models in `prisma/schema.prisma` and run `npx prisma migrate dev` to apply your schema.
+
+Learn more: https://pris.ly/getting-started
```
@@ -417,17 +433,26 @@ yarn run v1.22.0
warning package.json: No license field
$ /Users/janedoe/Desktop/tsdf/node_modules/.bin/prisma init
-✔ Your Prisma schema was created at prisma/schema.prisma.
- You can now open it in your favorite editor.
-Next steps:
-1. Set the DATABASE_URL in the .env file to point to your existing database. If your database has no tables yet, read https://pris.ly/d/getting-started.
-2. Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql or sqlite.
-3. Run `prisma db pull` to introspect your database schema and update the Prisma schema data models accordingly.
-4. Run `prisma generate` to install Prisma Client. You can then start querying your database.
+Initialized Prisma in your project
+
+ prisma/
+ schema.prisma
+ prisma.config.ts
-More information in our documentation:
-https://pris.ly/d/getting-started
+Next, choose how you want to set up your database:
+
+CONNECT EXISTING DATABASE:
+ 1. Configure your DATABASE_URL in `prisma.config.ts`
+ 2. Run `npx prisma db pull` to introspect your database.
+
+CREATE NEW DATABASE:
+ Local: npx prisma dev (runs Postgres locally in your terminal)
+ Cloud: npx create-db (creates a free Prisma Postgres database)
+
+ Then, define your models in `prisma/schema.prisma` and run `npx prisma migrate dev` to apply your schema.
+
+Learn more: https://pris.ly/getting-started
```
@@ -455,17 +480,25 @@ yarn run v1.22.0
warning package.json: No license field
$ /Users/janedoe/Desktop/tsdf/node_modules/.bin/prisma init
-✔ Your Prisma schema was created at prisma/schema.prisma.
- You can now open it in your favorite editor.
+Initialized Prisma in your project
+
+ prisma/
+ schema.prisma
+ prisma.config.ts
+
+Next, choose how you want to set up your database:
+
+CONNECT EXISTING DATABASE:
+ 1. Configure your DATABASE_URL in `prisma.config.ts`
+ 2. Run `npx prisma db pull` to introspect your database.
+
+CREATE NEW DATABASE:
+ Local: npx prisma dev (runs Postgres locally in your terminal)
+ Cloud: npx create-db (creates a free Prisma Postgres database)
-Next steps:
-1. Set the DATABASE_URL in the .env file to point to your existing database. If your database has no tables yet, read https://pris.ly/d/getting-started.
-2. Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql or sqlite.
-3. Run `prisma db pull` to introspect your database schema and update the Prisma schema data models accordingly.
-4. Run `prisma generate` to install Prisma Client. You can then start querying your database.
+ Then, define your models in `prisma/schema.prisma` and run `npx prisma migrate dev` to apply your schema.
-More information in our documentation:
-https://pris.ly/d/getting-started
+Learn more: https://pris.ly/getting-started
```