Skip to content

dolthub/dolt-prisma-example

Repository files navigation

Getting started with Dolt and Prisma

The code is described in detail in this blog.

Installation

$ yarn

Add connection env

Add a .env file with the following fields:

DB_HOST="host"
DB_PORT=3306
DB_USER="username"
DB_PASSWORD="password"
DB_NAME="database"
DB_URL="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}"

If your database server requires SSL for connections, you should specify the path to the SSL certificate and modify the DB_URL. Note that paths to certificates are resolved relative to the ./prisma directory:

DB_SSL_PATH="certificate path"
DB_URL="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}?sslmode=require&sslcert=${DB_SSL_PATH}"

Initialize

To create tables in the database, you will use the Prisma migrate dev command:

$ npx prisma migrate dev --name init

Seeding the database

To populate the database with data, we will use Prisma Client and run this command:

$ npx prisma db seed

About

A getting started guide with Dolt and Prisma

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published