cloudflare / cloudflare/cloudflare-docs
Clarify how to bind different D1 databases on preview URLs after migrating from Pages → Workers
- Dominant language
- MDX
- Stars
- 5.2k
- Forks
- 16.7k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 337
Description
### Proposed changes
- https://developers.cloudflare.com/workers/configuration/previews/
- https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/
Please add a short section to the Previews docs that answers:
* **Can a Worker that was migrated from Pages point at a different D1 database for its `*.workers.dev` preview URL?**
* If yes, document the two recommended approaches (e.g. `preview_database_id` vs. an explicit `[env.preview]` block).
* Show a minimal `wrangler.toml` / `wrangler.jsonc` snippet for each.
* Explain how this differs from the behaviour Pages had with preview deployments.
* Mention any “gotchas” (for example: `wrangler dev --remote` uses `preview_database_id`; `wrangler deploy` always uses the section you deploy).
This would save users from hunting through Discord / blog posts when they are simply trying to keep production and preview data separate.
### Subject Matter
D1 + Workers configuration – preview-time database binding
### Content Location
Primary:
https://developers.cloudflare.com/workers/configuration/previews/
Also reference:
https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/
(in the D1 section of the migration guide)
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.