Skip to content
On this page

Prisma CLI reference

This document describes the Prisma CLI commands, arguments, and options.

Usage

bash
dart run orm <command> [arguments]

Results

bash
 ◭ Prisma CLI 🚀
Prisma is a modern DB toolkit to query, migrate and model your database.
 More info: https://github.com/odroe/prisma-dart

Usage: dart run orm <command> [arguments]

Global options:
-h, --help       Print this usage information.
-v, --version    Print CLI and engines version.
    --debug      Print debug information.

Available commands:
  db         Manage your database schema and lifecycle
  format     Format a Prisma schema.
  generate   Generate artifacts
  init       Setup Prisma for you project
  precache   Populate the Prisma engines cache of binary artifacts.

Run "dart run orm help <command>" for more information about a command.

-v or --version

bash
dart run orm -v
Results
bash
Prisma CLI                              2.3.0
Prisma Binary Engines                   c875e43600dfe042452e0b868f7a48b817b9640b
Prisma Query C API                      0.0.1

init

Bootstraps a fresh Prisma project within the current directory.

The init command does not interpret any existing files. Instead, it creates a prisma directory containing a bare-bones schema.prisma file within your current directory.

Arguments

ArgumentRequiredDescriptionDefault
--urlNoDefine a custom datasource url.
--datasource-providerNoDefine the datasource provider, More see supported databases.postgresql

generate

The generate command generates assets like Prisma Client based on the generator and data model blocks defined in your prisma/schema.prisma file.

Prerequisites

To use the generate command, you must add a generator definition in your schema.prisma file. The prisma-client-dart generator, used to generate Prisma Client, can be added by including the following in your schema.prisma file:

prisma
generator client {
  provider = "prisma-client-dart"
}

Arguments

ArgumentRequiredDescriptionDefault
--schemaNoCustom path to your Prisma schemaprisma/schema.prisma
--[no-]data-proxyNoEnable the generated Prisma client to use the Data Proxy--no-data-proxy
--previewNoEnable Prisma ORM for Dart preview features

Preview Flags

FlagDescription
data-proxyEnable --data-proxy flag for generated PrismaClient.
finalizerEnable Finalizer feature for generated PrismaClient.

format

Formats the Prisma schema file, which includes validating, formatting, and persisting the schema.

Arguments

ArgumentRequiredDescriptionDefault
--schemaNoCustom path to your Prisma schemaprisma/schema.prisma

precache

Populate the Prisma engines cache of binary artifacts.

Arguments

ArgumentRequiredDescriptionDefault
-t, --typeNoPrisma engines types.[query, migration, introspection, format]

db pull

Pull the state from the database to the Prisma schema using introspection.

Arguments

ArgumentRequiredDescriptionDefault
--schemaNoCustom path to your Prisma schemaprisma/schema.prisma
--composite-type-depthNoSpecify the depth for introspecting composite types-1
--[no-]forceNoIgnore current Prisma schema file
--[no-]printNoPrint the introspected Prisma schema to stdout

db push

Push the state from your Prisma schema to your database.

Arguments

ArgumentRequiredDescriptionDefault
--schemaNoCustom path to your Prisma schemaprisma/schema.prisma
--[no-]force-resetNoForce a reset of the database before push

Released under the BSD-3-Clause License