Commit 6307a8f
fix(db): migrate script loads repo-root .env (#16)
`pnpm migrate:dev` from a clean shell failed with "DATABASE_URL_ADMIN
is not set" because the runner only read process.env and nothing loaded
.env. Load the repo-root .env via process.loadEnvFile() before reading
the vars - anchored to the script's own path, since `pnpm --filter`
runs with packages/db as the cwd. A missing .env is swallowed, so CI
and production (which set the vars directly) are unaffected.
Verified from a clean shell with nothing exported:
- .env present, DB already migrated -> exit 0, no error
- DATABASE_URL_ADMIN sourced only from .env -> applies all 13
- no .env + var exported -> works
- no .env + nothing set -> the intended "not set" error, no crash
Claude-Session: https://claude.ai/code/session_01Puf9jhj137U3iswf4GWZkG
Signed-off-by: Matthew Wren <info@origindev.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent 19bceb0 commit 6307a8f
1 file changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
20 | 34 | | |
21 | 35 | | |
22 | 36 | | |
| |||
0 commit comments