Skip to main content
Prisma Documentation Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

push (Prisma CLI v7)

Push the state from your Prisma schema to your database

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.

Bash
prisma db push [options]

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

Configure your database connection in prisma.config.ts:

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

datasource db {
  provider = "sqlite"
}
TypeScript
import { defineConfig, env } from "prisma/config";

export default defineConfig({
  schema: "prisma/schema.prisma",
  migrations: {
    path: "prisma/migrations",
  },
  datasource: {
    url: env("DATABASE_URL"),
  },
});
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
bun
bunx prisma db push
pnpm
pnpm prisma db push
yarn
yarn prisma db push
npm
npx prisma db push

Proceed even if the changes might result in data loss:

bun
bunx prisma db push --accept-data-loss
pnpm
pnpm prisma db push --accept-data-loss
yarn
yarn prisma db push --accept-data-loss
npm
npx prisma db push --accept-data-loss
bun
bunx prisma db push --schema=/tmp/schema.prisma
pnpm
pnpm prisma db push --schema=/tmp/schema.prisma
yarn
yarn prisma db push --schema=/tmp/schema.prisma
npm
npx prisma db push --schema=/tmp/schema.prisma

Reset the database before applying changes:

bun
bunx prisma db push --force-reset
pnpm
pnpm prisma db push --force-reset
yarn
yarn prisma db push --force-reset
npm
npx prisma db push --force-reset
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu