The Prisma Framework CLI currently requires Node 8 (or higher).
npm install -g prisma2
yarn global add prisma2
When installing the Prisma Framework CLI, a postinstall
hook is being executed. It downloads the Prisma Framework's query and migration engine binaries. The query engine contains the Prisma schema parser which is used by the prisma2 init
and the prism2 generate
commands. The migration engine is used by all prisma2 lift
commands.
The Prisma Framework CLI supports custom HTTP proxies. This is particularly relevant when being behind a corporate firewall.
To activate the proxy, provide the environment variables HTTP_PROXY
and/or HTTPS_PROXY
. The behavior is very similar to how the npm
CLI handles this.
The following environment variables can be provided:
HTTP_PROXY
orhttp_proxy
: Proxy URL for http traffic, for examplehttp://localhost:8080
HTTPS_PROXY
orhttps_proxy
: Proxy URL for https traffic, for examplehttps://localhost:8080
To get a local proxy, you can also use the
proxy
module:
Sets up Prisma (i.e., Photon and/or Lift) via an interactive wizard. You can specify your database connection and/or create a new database to work with. For a list with currently supported databases, see the this page. The wizard also allows you to derive a Prisma schema file from your existing database.
Starts Prisma development mode. This starts a server that lets you interact with your database and defined models. Note that Prisma Studio relies on your Prisma schema file to provide a fully featured user-interface with CRUD (create / read / update / delete) functionality.
Invokes all generators defined in the Prisma schema file. For example, this creates the Photon client to interact with the underlying database. Read more about Photon and its capabilities here.
Introspects the database and generates a data model from it. Basically, it analyzes your (already existing) database and automatically creates the Prisma schema file for you. This is useful, if you already have an existing application and want to start using the Prisma framework. Note that this command synchronizes your Prisma schema file according to your database structure; typically if you're not using Lift to migrate your database.
Creates a new migration based on changes on your data model. In this context it automatically documents all changes (i.e., a git diff
). All changes are only applied locally and are not applied to the database.
Runs all migrations that have not been applied to the database yet. This command effectively "replays" all local changes to the database.
This command reverts a database migration. In turn, it creates a "compensation" migration that undoes previous changes.