fix(db): resolve migrate.ts migrations path for Windows ESM compatibility#179
Conversation
…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>
|
Warning Review limit reached
Next review available in: 38 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Third occurrence of the same Windows/ESM
import.meta.resolve()bug asdrizzle.config.ts(#166) andcreateWorker.ts(#171):import.meta.resolve()returns afile:///C:/...URL string on Windows, and manually stripping thefile://prefix leaves an invalid path (/C:/...) instead of a real filesystem path — causingreaddirSync/path.jointo fail withENOENT.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 bareURLobject directly to the consumer — drizzle-orm'smigrate()callspath.join()onmigrationsFolderinternally, which requires a string, not aURLinstance.Test plan
pnpm test:unit(24 targets across 11 projects)pnpm prettier --check .packages/db/scripts/migrate.tsdirectly on Windows and confirmed it resolves to a correct native path (C:\...) and runs migrations without error