🚀 Feature Request: Single Command to Apply Migrations to All D1 Databases in Wrangler #13527
Replies: 3 comments
-
|
Agreed, we need to do this. |
Beta Was this translation helpful? Give feedback.
-
|
Any news on this? If every customer creates a database then I'd have to go migrating one by one to add a new column. |
Beta Was this translation helpful? Give feedback.
-
|
The only other solution would be to create a SQLite persisted Durable Object instance per tenant (which has been encouraged). That means you apply migrations on DO instantiation (not via wrangler ) but that can get out of hand as the DO schema grows and might even take too long to run for new instances. You also loose many valuable features of D1 like ... read-replication, time travel, encryption at the DB level (not just the filesystem level). Backup & restore might be a headache for large numbers of Tenant DO instances (you really want R2 backups for these DO databases). I think we want the ability to:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently working with multiple D1 databases with the same schema in a Cloudflare Workers project and facing a workflow challenge. My
wrangler.tomlfile defines numerous D1 database bindings, as shown below:Currently, to apply migrations, I need to execute
wrangler d1 migrations apply <database_name>individually for each database. This process is manageable but becomes cumbersome, especially when integrated into CI workflows.A potential command might look like
wrangler d1 migrations apply --all, automatically detecting and applying migrations to each database defined inwrangler.toml.Alternatively, the introduction of a
migration groupconcept could be considered. This would allow defining groups of databases inwrangler.tomlthat share the same schema, enabling us to apply migrations to all databases in a group with a single command.This feature would significantly improve the developer experience and efficiency for projects utilizing Cloudflare's D1 databases with Workers.
Beta Was this translation helpful? Give feedback.
All reactions