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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script
Create a new file named `index.ts` and add the following code to it:

```ts file=index.ts showLineNumbers
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'

const prisma = new PrismaClient()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script
Create a new file named `index.ts` and add the following code to it:

```ts file=index.ts showLineNumbers
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'

const prisma = new PrismaClient()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script
Create a new file named `index.ts` and add the following code to it:

```ts file=index.ts showLineNumbers
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'

const prisma = new PrismaClient()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script
Create a new file named `index.ts` and add the following code to it:

```ts file=index.ts showLineNumbers
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'

const prisma = new PrismaClient()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script
Create a new file named `index.ts` and add the following code to it:

```ts file=index.ts showLineNumbers
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'

const prisma = new PrismaClient()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For the purpose of this guide however, you'll just create a plain Node.js script
Create a new file named `index.ts` and add the following code to it:

```js file=index.ts copy
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'

const prisma = new PrismaClient()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ npx prisma migrate dev --name init
Paste the following boilerplate into `index.ts`:

```ts file=index.ts
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient().$extends(withAccelerate())
Expand All @@ -190,7 +190,7 @@ This code contains a `main` function that's invoked at the end of the script. It
Let's start with a small query to create a new `User` record in the database and log the resulting object to the console. Add the following code to your `index.ts` file:

```ts file=index.ts
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient().$extends(withAccelerate())
Expand Down Expand Up @@ -248,7 +248,7 @@ Prisma ORM offers various queries to read data from your database. In this secti
Delete the previous Prisma ORM query and add the new `findMany` query instead:

```ts file=index.ts
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient().$extends(withAccelerate())
Expand Down Expand Up @@ -302,7 +302,7 @@ One of the main features of Prisma ORM is the ease of working with [relations](/
First, adjust your script to include the nested query:

```ts file=index.ts
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient().$extends(withAccelerate())
Expand Down Expand Up @@ -367,7 +367,7 @@ npx tsx index.ts
In order to also retrieve the `Post` records that belong to a `User`, you can use the `include` option via the `posts` relation field:

```ts file=index.ts
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from './generated/prisma'
import { withAccelerate } from '@prisma/extension-accelerate'

const prisma = new PrismaClient().$extends(withAccelerate())
Expand Down
Loading