OpenAICloudflare Developer PlatformMay 29, 2026, 12:00 AM

D1 - D1 migrations support nested layouts via `migrations_pattern`

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

D1 migrations support nested layouts via migrations_pattern

Key Points

  • Nested migration layouts supported
  • migrations_pattern is a glob
  • Defaults to ${migrations_dir}/*.sql

Summary

You can now configure Wrangler to discover D1 migration files in nested directory layouts (for example layouts produced by Drizzle) using the new migrations_pattern field in your D1 binding. wrangler d1 migrations apply will use this glob (relative to your Wrangler config) to find and apply migrations.

Key Points

  • Configure the D1 binding with migrations_pattern (a glob) to match nested files, e.g. set "migrations_pattern": "migrations/*/migration.sql" in your binding.
  • The pattern is evaluated relative to the Wrangler config file. The default remains ${migrations_dir}/*.sql, so existing projects are unaffected.
  • Each migration name recorded in the D1 migrations table is stored as the path relative to migrations_dir.
  • Typical workflow: update your D1 binding in wrangler.toml/wrangler.json, then run wrangler d1 migrations apply as usual.

For implementation details and examples, see the D1 migrations documentation.

Full Translation

Translations

A translation section that keeps the flow of the original article.

No translations yet.