Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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: 2 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
# yaml template to refer to https://docs.coderabbit.ai/reference/yaml-template#enterprise
language: "en-US"
tone_instructions: "You are a principal engineer with natural teaching abilities. You detect issues and clearly explain why."
reviews:
collapse_walkthrough: false
profile: "chill"
Expand All @@ -14,6 +15,7 @@ reviews:
auto_review:
enabled: true
drafts: false
base_branches: [".*"]
finishing_touches:
docstrings:
enabled: false
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lychee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
--cache
--cache-exclude-status 429,500,502,503,504
--max-cache-age 5m
--verbose
--no-progress
--accept 200,201,204,304,403,429
--timeout 20
Expand All @@ -50,7 +49,6 @@ jobs:
args: >
--cache
--max-cache-age 5m
--verbose
--no-progress
--accept 200,201,204,304,403,429
--cache-exclude-status 429,500,502,503,504
Expand Down
30 changes: 19 additions & 11 deletions content/100-getting-started/01-quickstart-prismaPostgres.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,31 @@ At this point, you'll be redirected to the **Database** page where you will need

Once the green **`CONNECTED`** label appears, your database is ready to use!

## 2. Download example and install dependencies
## 2. Configure environment variables

Copy the `try-prisma` command that's shown in the Console, paste it into your terminal and execute it.
First, install the required dependency:

For reference, this is what the command looks like:
```bash
npm install dotenv --save-dev
```

```terminal
npx try-prisma@latest \
--template databases/prisma-postgres \
--name hello-prisma \
--install npm
Create a `.env` file in your project root (if it doesn't exist) and add your database connection string:

```env
DATABASE_URL="your_database_url_here"
```

Once the `try-prisma` command has terminated, navigate into the project directory:
Update your `prisma.config.ts` file in your project root:

```terminal
cd hello-prisma
```ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
datasource: {
url: env("DATABASE_URL"),
},
});
```

## 3. Set database connection URL
Expand Down
29 changes: 27 additions & 2 deletions content/100-getting-started/01-quickstart-sqlite.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,34 @@ Models in the Prisma schema have two main purposes:
- Represent the tables in the underlying database
- Serve as foundation for the generated Prisma Client API

In the next section, you will map these models to database tables using Prisma Migrate.
## 3. Configure environment variables

## 3. Run a migration to create your database tables with Prisma Migrate
First, install the required dependency:

```bash
npm install dotenv --save-dev
```

Create a `.env` file in your project root (if it doesn't exist) and add your database connection string:

```env
DATABASE_URL="your_database_url_here"
```

Update your `prisma.config.ts` file in your project root:

```ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
datasource: {
url: env("DATABASE_URL"),
},
});
```

## 4. Run a migration to create your database tables with Prisma Migrate

At this point, you have a Prisma schema but no database yet. Run the following command in your terminal to create the SQLite database and the `User` and `Post` tables represented by your models:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,35 @@ For improved compatibility with ECMAScript modules (ESM) and to ensure consisten

:::

## Loading environment variables

To load environment variables in your Prisma application, you can use the `prisma.config.ts` file along with the `env` helper from `prisma/config`. This approach provides better type safety and configuration management.

1. First, install the required dependency:

```bash
npm install dotenv --save-dev
```

2. Create a `.env` file in your project root (if it doesn't exist) and add your database connection string:

```env
DATABASE_URL="your_database_connection_string_here"
```

3. Update your `prisma.config.ts` file in your project root:

```ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
datasource: {
url: env("DATABASE_URL"),
},
});
```

## The `@prisma/client` npm package

The `@prisma/client` npm package consists of two key parts:
Expand Down
31 changes: 30 additions & 1 deletion content/200-orm/500-reference/325-prisma-config-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -597,4 +597,33 @@ You can specify a custom location for your config file when running Prisma CLI c

```terminal
prisma validate --config ./path/to/myconfig.ts
```
```

## Loading environment variables

To load environment variables in your Prisma application, you can use the `prisma.config.ts` file along with the `env` helper from `prisma/config`. This approach provides better type safety and configuration management.

1. First, install the required dependency:

```bash
npm install dotenv --save-dev
```

2. Create a `.env` file in your project root (if it doesn't exist) and add your database connection string:

```env
DATABASE_URL="your_database_connection_string_here"
```

3. Update your `prisma.config.ts` file in your project root:

```ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
datasource: {
url: env("DATABASE_URL"),
},
});
```
Loading