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
Copy file name to clipboardExpand all lines: content/250-postgres/300-database/550-local-development.mdx
+52-2Lines changed: 52 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,10 +83,48 @@ To transition to production, you only need to update the database URL in the `.e
83
83
You can target a specific, local Prisma Postgres instance via the `--name` (`-n`) option of the `prisma dev` command, for example:
84
84
85
85
```terminal
86
-
npx prisma dev --namemydb1
86
+
npx prisma dev --name="mydb1"
87
87
```
88
88
89
-
Whenever you pass the `--name mydb1` to `prisma dev`, the command will return the same connection string pointing to a local instance called `mydb1`.
89
+
Whenever you pass the `--name="mydb1"` to `prisma dev`, the command will return the same connection string pointing to a local instance called `mydb1`. This creates a named instance that you can later manage using the instance management commands.
90
+
91
+
## Starting existing Prisma Postgres instances in the background
92
+
93
+
You can start existing Prisma Postgres instances in the background using:
94
+
95
+
```terminal
96
+
npx prisma dev start <glob>
97
+
```
98
+
99
+
:::note
100
+
101
+
The `dev start` command only works with instances that already exist.
102
+
103
+
:::
104
+
105
+
`<glob>` is a placeholder for a glob pattern to specify which local Prisma Postgres instances should be started, for example:
106
+
107
+
```terminal
108
+
npx prisma dev start mydb # starts a DB called `mydb` in the background (only if it already exists)
109
+
```
110
+
111
+
To start all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`), you can use a glob:
112
+
113
+
```terminal
114
+
npx prisma dev start mydb* # starts all existing DBs starting with `mydb`
115
+
```
116
+
117
+
This command enables you to manage Prisma Postgres instances outside of the VS Code extension, allowing for background instance management in your development workflow.
118
+
119
+
## Listing Prisma Postgres instances
120
+
121
+
You can view all your local Prisma Postgres instances using:
122
+
123
+
```terminal
124
+
npx prisma dev ls
125
+
```
126
+
127
+
This command lists all available instances on your system, showing their current status and configuration.
90
128
91
129
## Stopping Prisma Postgres instances
92
130
@@ -108,6 +146,12 @@ To stop all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`),
108
146
npx prisma dev stop mydb* # stops all DBs starting with `mydb`
109
147
```
110
148
149
+
:::note
150
+
151
+
The `stop` command is interactive and includes safety prompts to prevent accidental operations. You'll be asked to confirm the action by typing a confirmation phrase.
152
+
153
+
:::
154
+
111
155
## Removing Prisma Postgres instances
112
156
113
157
Prisma Postgres saves the information and data from your local Prisma Postgres instances on your file system. To remove any trace from a database that's not in use any more, you can run the following command:
@@ -128,6 +172,12 @@ To stop all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`),
128
172
npx prisma dev rm mydb* # removes all DBs starting with `mydb`
129
173
```
130
174
175
+
:::note
176
+
177
+
The `rm` command is interactive and includes safety prompts to prevent accidental data loss. You'll be asked to confirm the action by typing a confirmation phrase that hints at the risks involved.
178
+
179
+
:::
180
+
131
181
## Using local Prisma Postgres with any ORM
132
182
133
183
Local Prisma Postgres supports [direct TCP connections](/postgres/database/direct-connections), allowing you to connect to it via any tool.
0 commit comments