Skip to content

fix: add migrations directory to D1 + Drizzle template to prevent ENOENT on dev#1000

Open
shkumbinhasani wants to merge 1 commit intoAmanVarshney01:mainfrom
shkumbinhasani:fix/d1-missing-migrations-dir
Open

fix: add migrations directory to D1 + Drizzle template to prevent ENOENT on dev#1000
shkumbinhasani wants to merge 1 commit intoAmanVarshney01:mainfrom
shkumbinhasani:fix/d1-missing-migrations-dir

Conversation

@shkumbinhasani
Copy link
Copy Markdown

Summary

  • Adds an empty migrations/.gitkeep to the db package template so packages/db/src/migrations exists after scaffolding
  • Fixes ENOENT crash when running bun run dev with D1 + Drizzle + Alchemy setup

Closes #999

Problem

Bun's fs.glob throws ENOENT when the target directory doesn't exist (unlike Node.js which returns empty). Alchemy's D1Database globs for *.sql files in the migrations directory, which crashes before the user has a chance to run db:generate.

Test plan

  • Scaffold a new project with D1, Drizzle, and Alchemy options
  • Run bun run dev immediately — should no longer crash

…ENT on dev

The drizzle config specifies out: "./src/migrations" but that directory
is never created during scaffolding. When Alchemy's D1Database globs for
SQL files in the non-existent directory, Bun's fs.glob throws ENOENT.

Adding .gitkeep ensures the directory exists after project creation so
`bun run dev` works before the user runs `db:generate`.

Closes AmanVarshney01#999
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

@shkumbinhasani is attempting to deploy a commit to the Better T Stack Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (1)
  • packages/template-generator/templates/db/drizzle/sqlite/src/migrations/.gitkeep
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9067af25-e420-410e-b016-c925ed601d9a

📥 Commits

Reviewing files that changed from the base of the PR and between c38bcc0 and d1074ff.

📒 Files selected for processing (1)
  • packages/template-generator/templates/db/drizzle/sqlite/src/migrations/.gitkeep

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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 and usage tips.

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.

bun run dev fails with ENOENT when using D1 + Drizzle + Alchemy — missing migrations directory

1 participant