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
53 changes: 49 additions & 4 deletions content/200-orm/500-reference/200-prisma-cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ The `dev` command starts a [local Prisma Postgres](/postgres/database/local-deve
| `--db-port` (or `-P`) | No | Port number the local Prisma Postgres database server will listen on. | `51214` |
| `--shadow-db-port` | No | Port number the shadow database server will listen on. | `51215` |
| `--debug` | No | Enable debug logging. | `false` |
| `--detach` | No | Create and start the instance in detached mode (running in the background). Useful for automated workflows and CI/CD pipelines. | `false` |

### Examples

Expand Down Expand Up @@ -879,6 +880,38 @@ Fetching latest updates for this subcommand...

</CodeWithResult>

### `dev start`

Starts existing [local Prisma Postgres](/postgres/database/local-development) instances in the background:

```terminal
npx prisma dev start <glob>
```

`<glob>` is a placeholder for a glob pattern to specify which local Prisma Postgres instances should be started, for example:

```terminal
npx prisma dev start mydb # starts a DB called `mydb` in the background
```

To start all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`), you can use a glob:

```terminal
npx prisma dev start mydb* # starts all DBs starting with `mydb`
```

This enables background instance management outside of the VS Code extension.

### `dev ls`

Lists all available [local Prisma Postgres](/postgres/database/local-development) instances:

```terminal
npx prisma dev ls
```

This command shows all instances on your system with their current status and configuration.

### `dev stop`

Stops one or more [local Prisma Postgres](/postgres/database/local-development) databases:
Expand All @@ -899,6 +932,12 @@ To stop all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`),
npx prisma dev stop mydb* # stops all DBs starting with `mydb`
```

:::note

The `stop` command is interactive and includes safety prompts to prevent accidental operations.

:::

### `dev rm`

Removes the data of one or more [local Prisma Postgres](/postgres/database/local-development) databases from your file system:
Expand All @@ -910,14 +949,20 @@ npx prisma dev rm <glob>
`<glob>` is a placeholder for a glob pattern to specify which local Prisma Postgres instances should be removed, for example:

```terminal
npx prisma dev stop mydb # stops a DB called `mydb`
npx prisma dev rm mydb # removes a DB called `mydb`
```

To stop all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`), you can use a glob:
To remove all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`), you can use a glob:

```terminal
npx prisma dev rm mydb* # removes all DBs starting with `mydb`
```
npx prisma dev stop mydb* # stops all DBs starting with `mydb`
```

:::note

The `rm` command is interactive and includes safety prompts to prevent accidental data loss.

:::


## `db`
Expand Down
54 changes: 54 additions & 0 deletions content/250-postgres/300-database/550-local-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,48 @@ npx prisma dev --name mydb1

Whenever you pass the `--name mydb1` to `prisma dev`, the command will return the same connection string pointing to a local instance called `mydb1`.

### Creating detached instances

You can create and start new Prisma Postgres instances in detached mode (running in the background) using the `--detach` flag:

```terminal
npx prisma dev --name mydb --detach
```

This creates a new instance and immediately starts it in the background, similar to `docker run`. This is particularly useful for automated workflows and CI/CD pipelines where you need instances to run without interactive terminals.

## Starting existing Prisma Postgres instances in the background

You can start existing Prisma Postgres instances in the background using:

```terminal
npx prisma dev start <glob>
```

`<glob>` is a placeholder for a glob pattern to specify which local Prisma Postgres instances should be started, for example:

```terminal
npx prisma dev start mydb # starts a DB called `mydb` in the background
```

To start all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`), you can use a glob:

```terminal
npx prisma dev start mydb* # starts all DBs starting with `mydb`
```

This command enables you to manage Prisma Postgres instances outside of the VS Code extension, allowing for background instance management in your development workflow.

## Listing Prisma Postgres instances

You can view all your local Prisma Postgres instances using:

```terminal
npx prisma dev ls
```

This command lists all available instances on your system, showing their current status and configuration.

## Stopping Prisma Postgres instances

You can stop a running Prisma Postgres instance with this command:
Expand All @@ -108,6 +150,12 @@ To stop all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`),
npx prisma dev stop mydb* # stops all DBs starting with `mydb`
```

:::note

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.

:::

## Removing Prisma Postgres instances

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:
Expand All @@ -128,6 +176,12 @@ To stop all databases that begin with `mydb` (e.g. `mydb-dev` and `mydb-prod`),
npx prisma dev rm mydb* # removes all DBs starting with `mydb`
```

:::note

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.

:::

## Using local Prisma Postgres with any ORM

Local Prisma Postgres supports [direct TCP connections](/postgres/database/direct-connections), allowing you to connect to it via any tool.
Expand Down
1 change: 1 addition & 0 deletions static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@
/reference/errors/migrate-resolve /docs/orm/prisma-migrate/workflows/patching-and-hotfixing#failed-migration
/reference/errors/migrate-shadow /docs/orm/prisma-migrate/understanding-prisma-migrate/shadow-database

/data-platform/accelerate/concepts* /docs/accelerate

### NO REDIRECTS BELOW THIS LINE. ADD REDIRECTS ABOVE THIS SECTION ###

Loading