Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 Feature Request: Single Command to Apply Migrations to All D1 Databases in Wrangler #4471

Open
sugar-cat7 opened this issue Nov 21, 2023 · 1 comment
Labels
d1 Relating to D1 enhancement New feature or request

Comments

@sugar-cat7
Copy link

sugar-cat7 commented Nov 21, 2023

I'm currently working with multiple D1 databases with the same schema in a Cloudflare Workers project and facing a workflow challenge. My wrangler.toml file defines numerous D1 database bindings, as shown below:

# Example wrangler.toml configuration
[[d1_databases]]
binding = "Test1"
database_name = "test-1"

[[d1_databases]]
binding = "Test2"
database_name = "test-2"

# ... additional configurations ...

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 in wrangler.toml.
Alternatively, the introduction of a migration group concept could be considered. This would allow defining groups of databases in wrangler.toml that 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.

@sugar-cat7 sugar-cat7 added the enhancement New feature or request label Nov 21, 2023
@rozenmd rozenmd added the d1 Relating to D1 label Nov 21, 2023
@rozenmd
Copy link
Contributor

rozenmd commented Nov 21, 2023

Agreed, we need to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d1 Relating to D1 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants