workers-sdk
workers-sdk copied to clipboard
D1 support
This adds wrangler d1 subcommand, that's been being tested on the wrangler@d1 tag:
wrangler d1
🗄 Interact with a D1 database
Commands:
wrangler d1 list List D1 databases
wrangler d1 create <name> Create D1 database
wrangler d1 delete <name> Delete D1 database
wrangler d1 backup Interact with D1 Backups
wrangler d1 execute <name> Executed command or SQL file
Flags:
-c, --config Path to .toml configuration file [string]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
At the moment it uses a prerelease version of miniflare, "2.8.2-d1.0", but that will be released properly soon and I'll update this PR.
🦋 Changeset detected
Latest commit: 200c7f2222c53286af7ce8211322b36036263f8c
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| wrangler | Patch |
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.developers.workers.dev/runs/3127583359/npm-package-wrangler-1687
You can reference the automatically updated head of this PR with:
npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/1687/npm-package-wrangler-1687
Or you can use npx with this latest build directly:
npx https://prerelease-registry.developers.workers.dev/runs/3127583359/npm-package-wrangler-1687 dev path/to/script.js
Codecov Report
Merging #1687 (200c7f2) into main (b829c9c) will decrease coverage by
2.03%. The diff coverage is37.05%.
@@ Coverage Diff @@
## main #1687 +/- ##
==========================================
- Coverage 77.62% 75.58% -2.04%
==========================================
Files 105 116 +11
Lines 7480 7855 +375
Branches 1974 2044 +70
==========================================
+ Hits 5806 5937 +131
- Misses 1674 1918 +244
| Impacted Files | Coverage Δ | |
|---|---|---|
| packages/wrangler/src/api/dev.ts | 69.23% <ø> (ø) |
|
| packages/wrangler/src/dialogs.tsx | 25.45% <0.00%> (-0.97%) |
:arrow_down: |
| packages/wrangler/src/user/user.tsx | 70.44% <ø> (ø) |
|
| packages/wrangler/src/d1/execute.tsx | 16.52% <16.52%> (ø) |
|
| packages/wrangler/src/d1/utils.ts | 20.00% <20.00%> (ø) |
|
| packages/wrangler/src/bundle.ts | 84.33% <22.22%> (-3.57%) |
:arrow_down: |
| packages/wrangler/src/d1/backups.tsx | 26.31% <26.31%> (ø) |
|
| packages/wrangler/src/d1/list.tsx | 30.76% <30.76%> (ø) |
|
| packages/wrangler/src/d1/options.ts | 33.33% <33.33%> (ø) |
|
| packages/wrangler/src/d1/delete.tsx | 34.78% <34.78%> (ø) |
|
| ... and 18 more |
We've found fixtures to be really great. Might be a bit of effort to set up with a sqlite file, but if there's going to be a chunky refactor for when it D1 GA's, it very well might be worth it.