Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
DATABASE_URL: ${{ secrets.DATABASE_URL_FOR_PRISMA_SQL_GENERATION }}
DIRECT_URL: ${{ secrets.DATABASE_URL_FOR_PRISMA_SQL_GENERATION }}
NEXT_PUBLIC_API_ENDPOINT: "sample"
NEXT_PUBLIC_FIREBASE_API_KEY: "sample"
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: "sample"
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ default: start
LOCAL_DB := postgres://user:password@localhost:5432/database

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

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

3 changes: 2 additions & 1 deletion server/.env.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Database
# DATABASE_URL=postgres://johndoe:[email protected]:5432/dbname
# below can be used for docker db created via `make dev-db`
DATABASE_URL=postgres://user:password@localhost:5432/database
DATABASE_URL=postgres://user:password@localhost:6543/database
DIRECT_URL=postgres://user:password@localhost:5432/database

# CORS allow origins, separated by "," | no space is allowed before/after ","
CORS_ALLOW_ORIGINS=http://localhost:3000,http://localhost:5173
Expand Down
2 changes: 2 additions & 0 deletions server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ generator client {
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
// https://github.com/prisma/prisma/discussions/25106#discussioncomment-10500102
directUrl = env("DIRECT_URL")
}

enum Day {
Expand Down