-
Notifications
You must be signed in to change notification settings - Fork 710
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
fix(d1): ensure that migrations support compound statements #2495
fix(d1): ensure that migrations support compound statements #2495
Conversation
🦋 Changeset detectedLatest commit: 0331160 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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/runs/3855177256/npm-package-wrangler-2495 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/prs/2495/npm-package-wrangler-2495 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/runs/3855177256/npm-package-wrangler-2495 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/runs/3855177256/npm-package-cloudflare-pages-shared-2495 |
Codecov Report
@@ Coverage Diff @@
## main #2495 +/- ##
=======================================
Coverage 72.24% 72.24%
=======================================
Files 156 156
Lines 9685 9685
Branches 2547 2547
=======================================
Hits 6997 6997
Misses 2688 2688 |
The new splitter.ts file has 100% code coverage in unit tests 💯 |
be2654a
to
0475d66
Compare
4a38e64
to
8f66793
Compare
This fix updates the SQL statement splitting so that it does not split in the middle of compound statements. Previously we were using a third party splitting library, but this needed fixing and was actually unnecessary for our purposes. So a new splitter has been implemented and the library dependency removed. Also the error handling in `d1 migrations apply` has been improved to handle a wider range of error types. Fixes cloudflare#2463
8f66793
to
0331160
Compare
What this PR solves / how to test:
This fix updates the SQL statement splitting so that it does not split in the middle of compound statements.
Previously we were using a third party splitting library, but this needed fixing and was actually unnecessary for our purposes.
So a new splitter has been implemented and the library dependency removed.
Also the error handling in
d1 migrations apply
has been improved to handle a wider range of error types.Fixes #2463
To test manually, create a simple migration script
migrations/0000_initial.sql
that contains a compound statement:Then update the wrangler to have a pseudo D1 binding:
Finally try to apply the migrations locally:
Associated docs issues/PR:
Author has included the following, where applicable:
Reviewer has performed the following, where applicable:
Fixes # [insert issue number].