fix: fix docker image by generating prisma client

This commit is contained in:
Tianzhou Chen
2023-06-17 18:03:54 +08:00
parent e99bf0deb9
commit 718b75baff
2 changed files with 16 additions and 18 deletions

View File

@ -77,6 +77,12 @@ docker run --name sqlchat --platform linux/amd64 --env OPENAI_API_KEY=xxx --env
pnpm i
```
1. Generate prisma client from the model
```bash
pnpm prisma generate
```
1. Make a copy of the example environment variables file:
```bash
@ -99,25 +105,17 @@ docker run --name sqlchat --platform linux/amd64 --env OPENAI_API_KEY=xxx --env
In `.env` file, assign the connection string to environment variable `DATABASE_URL` and `DATABASE_DIRECT_URL`. [This article](https://www.prisma.io/docs/data-platform/data-proxy/prisma-cli-with-data-proxy#set-a-direct-database-connection-url-in-your-prisma-schema) explains why we need two URLs.
1. Generate schema
1. Set up database schema
1. Generate prisma client from the model
```bash
pnpm prisma migrate dev
```
```bash
pnpm prisma generate
```
1. (Optional) Seed data
2. Migrate schema
```bash
pnpm prisma migrate dev
```
3. (Optional) Seed data
```bash
pnpm prisma db seed
```
```bash
pnpm prisma db seed
```
## Star History

View File

@ -3,11 +3,11 @@
"private": false,
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "prisma generate && next build",
"build-prisma-deploy": "prisma generate && next build && prisma migrate deploy",
"export": "next export",
"start": "next start",
"lint": "next lint",
"prisma-build": "prisma generate && prisma migrate deploy && next build",
"stripe": "stripe listen --forward-to localhost:3000/api/stripe/webhook"
},
"dependencies": {