Skip to content

Commit b381a20

Browse files
aster-voidnakaterm
authored andcommitted
fix: prisma couldn't build with --sql (#646)
1 parent 3fd17be commit b381a20

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
env:
99
DATABASE_URL: ${{ secrets.DATABASE_URL_FOR_PRISMA_SQL_GENERATION }}
10+
DIRECT_URL: ${{ secrets.DATABASE_URL_FOR_PRISMA_SQL_GENERATION }}
1011
NEXT_PUBLIC_API_ENDPOINT: "sample"
1112
NEXT_PUBLIC_FIREBASE_API_KEY: "sample"
1213
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: "sample"

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ default: start
33
LOCAL_DB := postgres://user:password@localhost:5432/database
44

55
test: export DATABASE_URL=$(LOCAL_DB)
6+
test: export DIRECT_URL=$(LOCAL_DB)
67
test: export UNSAFE_SKIP_AUTH=1
78
test: export FIREBASE_PROJECT_ID=mock-proj
89
test: export CORS_ALLOW_ORIGINS=http://localhost:3000,https://localhost:5173
@@ -13,6 +14,7 @@ test: dev-db
1314

1415
## server/.envをDATABASE_URL=postgres://user:password@localhost:5432/databaseにしてから行う
1516
dev-db: export DATABASE_URL=$(LOCAL_DB)
17+
dev-db: export DIRECT_URL=$(LOCAL_DB)
1618
dev-db: export NEVER_LOAD_DOTENV=1
1719
dev-db:
1820
docker stop postgres || true
@@ -29,7 +31,7 @@ dev-db:
2931
sleep 1; \
3032
done
3133
@echo "PostgreSQL is ready. Running seed..."
32-
@cd server; bunx prisma generate; bunx prisma db push
34+
@cd server; bunx prisma generate --sql; bunx prisma db push
3335
@bun run seed
3436
@echo "Seeding completed."
3537

server/.env.sample

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Database
22
# DATABASE_URL=postgres://johndoe:[email protected]:5432/dbname
33
# below can be used for docker db created via `make dev-db`
4-
DATABASE_URL=postgres://user:password@localhost:5432/database
4+
DATABASE_URL=postgres://user:password@localhost:6543/database
5+
DIRECT_URL=postgres://user:password@localhost:5432/database
56

67
# CORS allow origins, separated by "," | no space is allowed before/after ","
78
CORS_ALLOW_ORIGINS=http://localhost:3000,http://localhost:5173

server/prisma/schema.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ generator client {
88
datasource db {
99
provider = "postgresql"
1010
url = env("DATABASE_URL")
11+
// https://github.com/prisma/prisma/discussions/25106#discussioncomment-10500102
12+
directUrl = env("DIRECT_URL")
1113
}
1214

1315
enum Day {

0 commit comments

Comments
 (0)