Skip to content
Declarative data modeling & database migrations
TypeScript Other
Branch: master
Clone or download
prisma-bot 0.2.3
[skip ci]
Latest commit 3913f62 Aug 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.buildkite update pipeline Jun 28, 2019
docs Update Jul 24, 2019
examples finish integrating new migration engine interface Aug 15, 2019
scripts typo Jun 28, 2019
src cleanup tests Aug 15, 2019
.gitignore Merge Jul 26, 2019
.prettierrc.yml add datamodel printing Jun 8, 2019 [skip ci] Aug 15, 2019
download.js Merge Jul 26, 2019
jest.config.js fix generator handling Jun 25, 2019
logo.svg Add svg logo Jun 18, 2019
package.json 0.2.3 Aug 16, 2019
tsconfig.json wip Jun 15, 2019
tslint.json update tests Jun 25, 2019
yarn.lock Bump studio-server to 0.63.0 Aug 16, 2019


Declarative data modeling & database migrations

Get startedFeaturesDocsWorkflowSupported databases

Lift is a powerful database schema migration tool. It uses a declarative data modelling syntax to describe your database schema. Lift stores your entire migration history and easily lets you revert and replay migrations. When migrating your database with Lift, you can run provide before- and after-hooks to execute scripts, e.g. to populate the database with required values during a migration.

It is part of the Prisma 2 ecosystem. Prisma 2 provides database tools for data access, declarative data modeling, schema migrations and visual data management. Learn more in the Prisma 2 announcement.

Note that Lift is currently running in Preview. The version available has severe limitations that make it unsuitable for production workloads, including missing features, limited performance and stability issues. We will address all these limitations before issuing a stable release later this year.


Getting started

The easiest way to get started with Lift is by installing the Prisma 2 CLI and running the interactive init command:

npm install -g prisma2
prisma2 init hello-prisma

The interactive prompt will ask you to provide database credentials for your database. If you don't have a database yet, select SQLite and let the CLI set up a database file for you.

Learn more about the prisma2 init flow here.


  • Declarative data modelling syntax
  • Supports relational and document databases (more coming soon)
  • Keeps a migration history
  • Before- and after hooks to run scripts for complex migrations
  • Simple defaults, optional complexity for advanced use cases
  • Revert and replay migrations
  • Works with existing databases using schema introspection
  • CLI to support all major workflows


You can find comprehensive documentation for Lift in the Prisma 2 docs.

The Lift workflow

1. Configure database access

Specify the connection details for your database as a data source in your Prisma schema file. The connection details might differ per database, but most commonly you'll probide the following:

  • Host: The IP address or domain name of the machine where your database server is running.
  • Port: The port on which your database server is listening.
  • User & password: Credentials for your database server.

Here is an example project file that connects to a local PostgreSQL database:

// schema.prisma

datasource postgres {
  url      = "postgresql://user:password@localhost:5432"
  provider = "postgres"

generator photonjs {
  provider = 'photonjs'

2. Define initial data model

The data model definition is a declarative and human-readable representation of your database schema. Here is the project file from above extended with a sample data model:

// schema.prisma

datasource postgres {
  url      = "postgresql://user:password@localhost:5432"
  provider = "postgres"

generator photonjs {
  provider = 'photonjs'

model User {
  id        Int      @id
  createdAt DateTime @default(now())
  email     String   @unique
  name      String?
  role      Role     @default(USER)
  posts     Post[]

model Post {
  id         Int        @id
  createdAt  DateTime   @default(now())
  updatedAt  DateTime   @updatedAt
  author     User
  title      String
  published  Boolean    @default(false)

enum Role {

Option A: Starting with an existing database (brownfield)

If you want to use Lift with an existing database, you can introspect your database schema using the Prisma 2 CLI. This generates a declarative data model which provides the foundation for future migrations.

Option B: Start from scratch (greenfield)

When starting from scratch, you can simply write your own data model definition inside your schema file. You can then use the Lift CLI commands to migrate your database (Lift maps your data model definition to the schema of the underlying database).

3. Adjust the data model

Instead of sending SQL migration statements to the database, you need to adjust the data model file to describe your desired database schema. You can express any schema migration you like using the new data model, this includes for example adding a new model, removing a model or updating the fields of a model. You can also add indexes or validation constraints in the data model.

You can create a new migration for your change by running prisma lift save:

prisma lift save --name "add-comment-model"

4. Migrate your database (apply data model changes)

Once you're happy with the changes, you can use the Prisma CLI to migrate your database (i.e. map the adjusted data model to your database). Lift's migration engine will generate the corresponding SQL statements and send them to the database for you.

prisma lift up

Supported databases

Photon JS can be used with the following databases:

  • MySQL
  • PostgreSQL
  • MongoDB (coming very soon)

More databases that will be supported in the future are:

  • MS SQL
  • Oracle
  • Neo4J
  • FaunaDB
  • ...
You can’t perform that action at this time.