# push (Prisma CLI v7) (/docs/cli/v7/db/push)

Push the state from your Prisma schema to your database

Location: CLI > v7 > db > push

The `prisma db push` command pushes the state of your Prisma schema to the database without using migrations. It creates the database if it does not exist.

This command is a good choice when you don't need to version schema changes, such as during prototyping and local development.

## Usage

```bash
prisma db push [options]
```

The datasource URL configuration is read from the Prisma config file (e.g., `prisma.config.ts`).

## Prerequisites

Configure your database connection in `prisma.config.ts`:

```prisma file=schema.prisma
generator client {
  provider = "prisma-client"
  output   = "../generated/prisma"
}

datasource db {
  provider = "sqlite"
}
```

```typescript file=prisma.config.ts
import { defineConfig, env } from "prisma/config";

export default defineConfig({
  schema: "prisma/schema.prisma",
  migrations: {
    path: "prisma/migrations",
  },
  datasource: {
    url: env("DATABASE_URL"),
  },
});
```

## Options

| Option               | Description                                             |
| -------------------- | ------------------------------------------------------- |
| `-h`, `--help`       | Display help message                                    |
| `--config`           | Custom path to your Prisma config file                  |
| `--schema`           | Custom path to your Prisma schema                       |
| `--url`              | Override the datasource URL from the Prisma config file |
| `--accept-data-loss` | Ignore data loss warnings                               |
| `--force-reset`      | Force a reset of the database before push               |

> \[!WARNING]
> In Prisma v7, `db push` no longer runs `prisma generate` automatically. Run it explicitly if needed.

## Examples

### Push the schema to the database

#### bun

```bash
bunx prisma db push
```

#### pnpm

```bash
pnpm prisma db push
```

#### yarn

```bash
yarn prisma db push
```

#### npm

```bash
npx prisma db push
```

### Accept data loss

Proceed even if the changes might result in data loss:

#### bun

```bash
bunx prisma db push --accept-data-loss
```

#### pnpm

```bash
pnpm prisma db push --accept-data-loss
```

#### yarn

```bash
yarn prisma db push --accept-data-loss
```

#### npm

```bash
npx prisma db push --accept-data-loss
```

### Specify a schema path

#### bun

```bash
bunx prisma db push --schema=/tmp/schema.prisma
```

#### pnpm

```bash
pnpm prisma db push --schema=/tmp/schema.prisma
```

#### yarn

```bash
yarn prisma db push --schema=/tmp/schema.prisma
```

#### npm

```bash
npx prisma db push --schema=/tmp/schema.prisma
```

### Force reset before push

Reset the database before applying changes:

#### bun

```bash
bunx prisma db push --force-reset
```

#### pnpm

```bash
pnpm prisma db push --force-reset
```

#### yarn

```bash
yarn prisma db push --force-reset
```

#### npm

```bash
npx prisma db push --force-reset
```

## See also

- [Conceptual overview of `db push` and when to use it over Prisma Migrate](/guides/prisma-migrate-v7-workflows-prototyping-your-schema)
- [Schema prototyping with `db push`](/guides/prisma-migrate-v7-workflows-prototyping-your-schema)

## Related pages

- [`execute`](/guides/db-commands-db-execute): Execute native commands to your database
- [`pull`](/guides/db-commands-db-pull): Pull the state from the database to the Prisma schema using introspection
- [`seed`](/guides/db-commands-db-seed): Seed your database with test or initial data using custom scripts

## Related pages

- [Authentication & Tools](./authentication-tools-index.md)
- [Build](./build-index.md)
- [Changelog](../changelog.md)
- [Concepts](./concepts-index.md)
- [Console commands](./console-commands-index.md)
- [Contract Authoring](./contract-authoring-index.md)
- [Core Concepts](./core-concepts-index.md)
- [Data Modeling](./data-modeling-index.md)
- [Database](./database-index.md)
- [DB commands](./db-commands-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
