Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dolthub/dolt-prisma-example
A getting started guide with Dolt and Prisma
https://github.com/dolthub/dolt-prisma-example
Last synced: 3 days ago
JSON representation
A getting started guide with Dolt and Prisma
- Host: GitHub
- URL: https://github.com/dolthub/dolt-prisma-example
- Owner: dolthub
- License: apache-2.0
- Created: 2024-06-24T23:07:32.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-04T17:53:31.000Z (29 days ago)
- Last Synced: 2024-12-31T05:46:18.470Z (3 days ago)
- Language: TypeScript
- Size: 54.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Getting started with [Dolt](https://doltdb.com) and [Prisma](https://www.prisma.io/)
The code is described in detail in [this blog](https://www.dolthub.com/blog/2024-06-28-dolt-and-prisma/).
## Installation
```
$ yarn
```## Add connection env
Add a `.env` file with the following fields:
```shell
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:
```shell
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
```