-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[D1] default wrangler d1 execute to local mode first.
#4930
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 8a0ae7a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8189879018/npm-package-wrangler-4930You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/4930/npm-package-wrangler-4930Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8189879018/npm-package-wrangler-4930 dev path/to/script.jsAdditional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8189879018/npm-package-create-cloudflare-4930 --no-auto-updatenpm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8189879018/npm-package-cloudflare-kv-asset-handler-4930npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8189879018/npm-package-miniflare-4930npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8189879018/npm-package-cloudflare-pages-shared-4930npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8189879018/npm-package-cloudflare-vitest-pool-workers-4930Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4930 +/- ##
==========================================
+ Coverage 70.35% 70.46% +0.11%
==========================================
Files 298 298
Lines 15567 15571 +4
Branches 4007 4008 +1
==========================================
+ Hits 10952 10972 +20
+ Misses 4615 4599 -16
|
d7d697a to
c60edc2
Compare
|
Hi 👋, While I do agree with the local-first approach this PR proposes for D1, merging it without other products following will add additional complexity for users - which commands need --local, and which ones do --remote? Until now, it used to be cc @admah |
We should definitely avoid subcommand groups that further nest products. |
|
An extremely common point of confusion is that |
The same could be said about KV, for example:
I agree that it wouldn't be the best solution, just an idea. Could also be |
|
Hey @DaniFoldi. This is a good callout, but right now we have a decision to make before we go GA on whether we want to be inconsistent with KV or inconsistent with dev and the latter has led to substantial confusion among beta customers. Defaulting to local is also a much safer alternative because it reduces the likelihood that someone would inadvertently touch to production. |
|
@joshthoward @rozenmd If |
|
@vy-ton is this not what happens? It's what Max included in the description. |
|
@joshthoward My migration executed remotely (I see the tables in dash) |
|
@vy-ton @joshthoward this PR is not ready for review |
c60edc2 to
8733b9c
Compare
Update helpers.ts
771202e to
6e08564
Compare
This PR defaults both
wrangler d1 executeandwrangler d1 migrations applyto use the local development environment provided by wrangler to match the default behaviour inwrangler dev.BREAKING CHANGE:
wrangler d1 executeandwrangler d1 migrations applynow default--localtotrue. When runningwrangler d1 executeorwrangler d1 migrations applyagainst a remote D1 database, you will need to provide the--remoteflag.Why?
wrangler devused to default to remote preview Workers, andwrangler d1 execute/wrangler d1 migrations applyfollowed this practice. With wrangler v3,wrangler devwas updated without updatingwrangler d1 execute/wrangler d1 migrations apply. This PR fixes this, and ensureswrangler devandwrangler d1 execute/wrangler d1 migrations applymatch again.Closes STOR-2892 internally.
Preview
You can try this out via
npx wrangler@d1. For example:What this looks like:
Local
Remote
Relevant docs PR: cloudflare/cloudflare-docs#13353