fix(backend): load DATABASE_URL for Prisma CLI from repo root .env

Use dotenv-cli for db:push, db:seed, db:studio, and migrate:deploy so they
match the API (root .env). Load dotenv in seed.ts for direct runs.
Document absolute DATABASE_URL in .env.example.

Made-with: Cursor
This commit is contained in:
Michilis
2026-04-01 20:01:56 +00:00
parent 8cdf0231ce
commit 51fe1497ae
4 changed files with 127 additions and 4 deletions

View File

@@ -5,9 +5,10 @@
"dev": "tsx watch src/index.ts",
"build": "tsc",
"start": "node dist/index.js",
"db:push": "prisma db push",
"db:seed": "prisma db seed",
"db:studio": "prisma studio"
"db:push": "dotenv -e ../.env -- prisma db push",
"db:seed": "dotenv -e ../.env -- prisma db seed",
"db:studio": "dotenv -e ../.env -- prisma studio",
"migrate:deploy": "dotenv -e ../.env -- prisma migrate deploy"
},
"prisma": {
"seed": "tsx prisma/seed.ts"
@@ -16,6 +17,7 @@
"@prisma/client": "^6.0.0",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"dotenv-cli": "^11.0.0",
"express": "^4.21.0",
"helmet": "^8.1.0",
"jsonwebtoken": "^9.0.2",