You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: update more tests to use ppg dev
* fix: update schema.prisma file
* fix: add schema path
* fix: go back to root path
* fix: update more readmes
* fix: resolve prisma types in react router 7 code
Copy file name to clipboardExpand all lines: orm/astro/README.md
+9-32Lines changed: 9 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,52 +35,29 @@ npm install
35
35
36
36
</details>
37
37
38
-
#### [Optional] Switch database to Prisma Postgres
38
+
###2. Add a Prisma Postgres instance connection string
39
39
40
-
This example uses a local SQLite database by default. If you want to use to [Prisma Postgres](https://prisma.io/postgres), follow these instructions (otherwise, skip to the next step):
40
+
This example uses a [Prisma Postgres](https://prisma.io/postgres) database by default. To get started with the project, you will need to setup a Prisma Postgres connection string:
41
41
42
-
1. Set up a new Prisma Postgres instance in the Prisma Data Platform [Console](https://console.prisma.io) and copy the database connection URL.
43
-
2. Update the `datasource` block to use `postgresql` as the `provider` and paste the database connection URL as the value for `url`:
This example uses a [Prisma Postgres](https://prisma.io/postgres) database by default. To get started with the project, you will need to setup a Prisma Postgres connection string:
51
45
52
-
> **Note**: In production environments, we recommend that you set your connection URL via an [environment variable](https://www.prisma.io/docs/orm/more/development-environment/environment-variables/managing-env-files-and-setting-variables), e.g. using a `.env` file.
46
+
1. Set up a new Prisma Postgres instance in the [Prisma Data Platform Console](https://console.prisma.io) and copy the database connection URL.
53
47
54
-
3. Install the Prisma Accelerate extension:
55
-
```
56
-
npm install @prisma/extension-accelerate
57
-
```
58
-
4. Add the Accelerate extension to the `PrismaClient` instance:
59
-
60
-
```diff
61
-
+ import { withAccelerate } from "@prisma/extension-accelerate"
62
-
63
-
+ const prisma = new PrismaClient().$extends(withAccelerate())
64
-
```
65
-
66
-
5. Pass the `.env` var `DATABASE_URL` into the `PrismaClient()`
67
-
```diff
68
-
+ const prisma = new PrismaClient({
69
-
+ datasourceUrl: import.meta.env.DATABASE_URL,
70
-
+ }).$extends(withAccelerate())
71
-
```
48
+
2. Add your database url to the `.env`
72
49
73
50
That's it, your project is now configured to use Prisma Postgres!
74
51
75
-
### 2. Generate Prisma Client
52
+
### 3. Generate Prisma Client
76
53
77
54
Run the following command to generate the Prisma Client. This is what you will be using to interact with your database.
78
55
79
56
```
80
57
npx prisma generate
81
58
```
82
59
83
-
### 3. Start the Astro server
60
+
### 4. Start the Astro server
84
61
85
62
```
86
63
npm run dev
@@ -90,7 +67,7 @@ The server is now running at http://localhost:4321
90
67
91
68
## Switch to another database
92
69
93
-
If you want to try this example with another database than SQLite, refer to the [Databases](https://www.prisma.io/docs/orm/overview/databases) section in our documentation
70
+
If you want to try this example with another database rather than Prisma Postgres, refer to the [Databases](https://www.prisma.io/docs/orm/overview/databases) section in our documentation
0 commit comments