Skip to content

Commit

Permalink
include link to README in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia-bq committed Dec 9, 2024
1 parent 96e1a7f commit 0553727
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
- [Plugin Service](../docs/development-guide/PluginService.md)
- [Pipelines](../docs/development-guide/Pipelines.md)
- [Read-Write Splitting Plugin Performance Results](../docs/development-guide/ReadWriteSplittingPerformanceResults.md)
- [Using The NodeJS Wrapper with Prisma ORM](./../examples/prisma_example/README.md)
11 changes: 7 additions & 4 deletions examples/prisma_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

In this tutorial, you will set up a Prisma application with the AWS Advanced NodeJS Wrapper, and use the Prisma client to execute a simple database operation.

> [!NOTE] This tutorial was written for a PostgreSQL datasource using the following technologies:
> [!NOTE]
> This tutorial was written for a PostgreSQL datasource using the following technologies:
>
> - Prisma 6.0.1
> - AWS Advanced NodeJS Driver 1.0.0
Expand Down Expand Up @@ -45,7 +46,8 @@ Your Prisma project should have the following project hierarchy:
└───index.ts
```

> [!NOTE] The adapter directory will contain all the files that you will need in Step 4. For simplicity, the diagram above only shows the files that either need to be added or require modifications.
> [!NOTE]
> The adapter directory will contain all the files that you will need in Step 4. For simplicity, the diagram above only shows the files that either need to be added or require modifications.
## Step 2: Add the required dependencies

Expand All @@ -65,7 +67,7 @@ You can use `pnpm install` to obtain the following dependencies after adding to

## Step 3: Generate the data model.

First edit `DATABASE_URL` in the `.env` file to be the connection string to your datasource.
First edit `DATABASE_URL` in the `.env` file to be the connection string to your datasource. The `DATABASE_URL` will only be used in this step, afterward you will create an AwsPgClient object and connect with the parameters specified in the client configuration.

The data model can either be generated by reading it out from an existing database or by manually creating it. When it is manually created, it can be transferred to the database using [Prisma Migrate](https://www.prisma.io/docs/orm/prisma-migrate/getting-started).

Expand All @@ -88,7 +90,8 @@ Set up an AwsPgClient that connects to your database instance. Details can be fo

To configure Prisma to use the datasource specified in the AwsPgClient, you will need a [driver adapter](https://www.prisma.io/docs/orm/overview/databases/database-drivers). Under the adapter directory of this tutorial is a partially implemented adapter that supports simple queries.

> [!NOTE] This adapter is modeled after Prisma's [adapter-pg](https://github.com/prisma/prisma/tree/main/packages/adapter-pg). For full functionality, the adapter files in this tutorial may need to be adjusted or customized.
> [!NOTE]
> This adapter is modeled after Prisma's [adapter-pg](https://github.com/prisma/prisma/tree/main/packages/adapter-pg). For full functionality, the adapter files in this tutorial may need to be adjusted or customized.
Since driver adapters are currently in Preview, you need to enable its feature flag on the datasource block in your Prisma schema:

Expand Down
6 changes: 6 additions & 0 deletions examples/prisma_example/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ datasource db {
url = env("DATABASE_URL")
}

model bank_test {
id Int @id
name String? @db.VarChar(40)
account_balance Int?
}

model Post {
id Int @id @default(autoincrement())
title String
Expand Down

0 comments on commit 0553727

Please sign in to comment.