Skip to content

fix(db): resolve migrate.ts migrations path for Windows ESM compatibility#179

Merged
fennifith merged 1 commit into
playfulprogramming:mainfrom
bbornino:fix/migrate-windows-path
Jul 4, 2026
Merged

fix(db): resolve migrate.ts migrations path for Windows ESM compatibility#179
fennifith merged 1 commit into
playfulprogramming:mainfrom
bbornino:fix/migrate-windows-path

Conversation

@bbornino

@bbornino bbornino commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Third occurrence of the same Windows/ESM import.meta.resolve() bug as drizzle.config.ts (#166) and createWorker.ts (#171): import.meta.resolve() returns a file:///C:/... URL string on Windows, and manually stripping the file:// prefix leaves an invalid path (/C:/...) instead of a real filesystem path — causing readdirSync/path.join to fail with ENOENT.

Found while working on #81, unrelated to that PR's scope.

Unlike the prior two fixes, this uses fileURLToPath(new URL(...)) rather than passing a bare URL object directly to the consumer — drizzle-orm's migrate() calls path.join() on migrationsFolder internally, which requires a string, not a URL instance.

Test plan

  • pnpm test:unit (24 targets across 11 projects)
  • pnpm prettier --check .
  • Ran packages/db/scripts/migrate.ts directly on Windows and confirmed it resolves to a correct native path (C:\...) and runs migrations without error

…lity

Third occurrence of the same import.meta.resolve() bug as
drizzle.config.ts (PR playfulprogramming#166) and createWorker.ts (PR playfulprogramming#171): on Windows
it returns a file:///C:/... URL string, and manually stripping the
file:// prefix leaves an invalid path (/C:/...) rather than a proper
one. Found while working on playfulprogramming#81.

Unlike the prior two fixes, this uses fileURLToPath(new URL(...))
rather than passing a bare URL object, since drizzle-orm's migrator
calls path.join() on migrationsFolder internally and requires a string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bbornino, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0aaab028-72bb-47a7-8a8b-69b9f7eef79e

📥 Commits

Reviewing files that changed from the base of the PR and between 1f14edd and cd01166.

📒 Files selected for processing (1)
  • packages/db/scripts/migrate.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fennifith fennifith added this pull request to the merge queue Jul 4, 2026
Merged via the queue into playfulprogramming:main with commit baf56a6 Jul 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants