Skip to content

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Fixes #7657

This PR adds printResourceLocation: true to the behaviour configuration of D1 commands that support --local/--remote flags. This enables these commands to display whether they're running against local or remote databases before showing any confirmation prompts, eliminating user confusion about which database will be affected.

What Changed

Added printResourceLocation: true to four D1 commands:

  • wrangler d1 execute
  • wrangler d1 export
  • wrangler d1 migrations apply
  • wrangler d1 migrations list

How It Works

The printResourceLocation feature is already implemented in the command framework (register-yargs-command.ts). When enabled, it:

  1. Checks for --local/--remote flags in the command arguments
  2. Determines if the resource is local using the isLocal() helper
  3. Prints "Using local resources" or "Using remote resources" accordingly
  4. Shows helpful guidance about switching between local/remote modes

This same pattern is already used successfully in KV and R2 commands.

Human Review Checklist

Most important to verify:

  • Confirm the four commands modified are the complete/correct set (did I miss any D1 commands with --local/--remote flags?)
  • Verify the framework's printResourceLocation logic will work properly with D1 command argument structures
  • Consider whether specific tests should be added for this behavior (currently relies on framework-level testing)

Additional items:

  • Changeset message is appropriate for end users
  • No other D1 commands need this behavior

Link to Devin run: https://app.devin.ai/sessions/97e9a99e8308471185de7052745a358f
Requested by: @smacleod

  • Tests
    • Tests not necessary because: this enables an existing framework feature that is already tested at the framework level, and the change is a simple one-line addition to command definitions
  • Public documentation
    • Documentation not necessary because: this is a UX improvement that doesn't change functionality or require user action - the behavior will be automatically visible to users
  • Wrangler V3 Backport
    • Wrangler PR:

Fixes #7657

Add printResourceLocation behaviour to d1 execute, export, migrations apply,
and migrations list commands to show local/remote status before confirmation
prompts.

Co-Authored-By: [email protected] <[email protected]>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link

changeset-bot bot commented Oct 8, 2025

🦋 Changeset detected

Latest commit: 8e01911

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Oct 8, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@10912

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@10912

miniflare

npm i https://pkg.pr.new/miniflare@10912

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@10912

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@10912

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@10912

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@10912

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@10912

wrangler

npm i https://pkg.pr.new/wrangler@10912

commit: 8e01911

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

🐛 BUG: Confusing messaging about whether wrangler d1 migrations apply is running against local vs remote DB
0 participants