Title: Managed MySQL deploys send a migration without breakpoints as one multi-statement query, which Hyperdrive does not support · Issue #414 · voidzero-dev/void · GitHub
Open Graph Title: Managed MySQL deploys send a migration without breakpoints as one multi-statement query, which Hyperdrive does not support · Issue #414 · voidzero-dev/void
X Title: Managed MySQL deploys send a migration without breakpoints as one multi-statement query, which Hyperdrive does not support · Issue #414 · voidzero-dev/void
Description: Problem A MySQL app deploys to the Void platform with void deploy. The platform applies pending migrations through the app Worker's migration handler. That handler reaches MySQL through Hyperdrive. A migration file can have several state...
Open Graph Description: Problem A MySQL app deploys to the Void platform with void deploy. The platform applies pending migrations through the app Worker's migration handler. That handler reaches MySQL through Hyperdrive....
X Description: Problem A MySQL app deploys to the Void platform with void deploy. The platform applies pending migrations through the app Worker's migration handler. That handler reaches MySQL through Hyperdr...
Opengraph URL: https://github.com/voidzero-dev/void/issues/414
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Managed MySQL deploys send a migration without breakpoints as one multi-statement query, which Hyperdrive does not support","articleBody":"## Problem\n\nA MySQL app deploys to the Void platform with `void deploy`. The platform applies pending migrations through the app Worker's migration handler. That handler reaches MySQL through Hyperdrive.\n\nA migration file can have several statements and no `--> statement-breakpoint` lines. A hand-written file is the usual case; `void db generate` adds the lines. The handler sends such a file as one query, on a connection opened with `multipleStatements: true`.\n\nCloudflare's Hyperdrive docs list \"Multi-statement queries\" as an unsupported MySQL feature. So this file will probably fail on a real Hyperdrive, and the deploy stops. **We have not run this against a real Hyperdrive.** Miniflare's local Hyperdrive is a plain TCP proxy, so local runs pass.\n\n| Path | Connects through | File with several statements and no breakpoints |\n| --- | --- | --- |\n| `void db migrate`, `void deploy --platform cloudflare` | `DATABASE_URL`, direct | sent as one query; MySQL accepts it |\n| `void deploy` (Void platform) | Hyperdrive | sent as one query; unsupported per Cloudflare docs |\n\nTwo related gaps for the same files:\n\n1. **No partial-apply note.** When a file fails partway, `void db migrate` adds a note: \"MySQL commits schema changes immediately, so earlier statements in `\u003cfile>` may already be applied...\". The note shows only when at least one statement finished. A file without breakpoints is one query, so the count stays 0 and the note never shows, even when its first `CREATE TABLE` was committed. On MySQL 8.4:\n\n ```\n ■ migration 0002_comments.sql failed: Key column 'nope' doesn't exist in table\n ```\n\n The table `comments` now exists, but the file is not recorded. The next run fails with `Table 'comments' already exists`. The same SQL with a breakpoint line shows the note.\n\n2. **Sharded Vitess.** Each file runs between `BEGIN` and `COMMIT`. On a sharded Vitess keyspace (for example PlanetScale MySQL), the default transaction mode is `MULTI`. A commit that fails on one shard does not roll back the shards that already committed (Vitess docs, shard isolation and atomicity). So a data-only file that writes to several shards can partly apply. `docs/guide/database/mysql.md:58` says \"a failed file that only changes data leaves the database unchanged\". Not run on a sharded keyspace.\n\n## Repro\n\nHyperdrive (not confirmed live):\n\n1. In a MySQL app, add `db/migrations/0002_two.sql` (and its journal entry) with no breakpoint line:\n ```sql\n CREATE TABLE comments (id int primary key);\n CREATE TABLE tags (id int primary key);\n ```\n2. Run `void deploy` to the Void platform.\n3. Per Cloudflare's docs, Hyperdrive rejects the multi-statement query and the migration fails.\n\nMissing note (seen on MySQL 8.4):\n\n1. Add `0002_comments.sql` with no breakpoint line:\n ```sql\n CREATE TABLE comments (id int primary key);\n ALTER TABLE counters ADD CONSTRAINT bad FOREIGN KEY (nope) REFERENCES comments(id);\n ```\n2. Run `void db migrate`. The error has no note, and `comments` exists.\n3. Run it again: `Table 'comments' already exists`.\n\n## Cause\n\n- `packages/void/src/runtime/migration-handler-mysql.ts:53-57` opens the Hyperdrive connection with `multipleStatements: true`; `:88-91` sends each piece from `splitMigrationSql`. On main: `:51-54` and `:71-73`.\n- `packages/void/src/runtime/migration-handler.ts:714-720`: `splitMigrationSql` returns the whole file as one piece when it has no breakpoint line.\n- `packages/void/src/migrations/runner-mysql.ts:148-167`: `ran` counts finished queries, and the note needs `ran > 0` (`:163-164`, message at `:115-126`).\n\n## Suggested fix\n\n- For MySQL, reject a file with several statements and no breakpoint lines when Void plans migrations, with a clear message (\"add `--> statement-breakpoint` after each statement\"). Then drop `multipleStatements` from the Hyperdrive connection. A SQL-aware splitter is the other option, but it must respect strings, comments and `BEGIN ... END` bodies.\n- Show the note for a failed file without breakpoints when the file has more than one statement and the transaction is no longer open.\n- Docs: say that on sharded Vitess a file that writes to several shards is not atomic.\n- Check the behavior once against a real Hyperdrive.\n\n## Evidence\n\n- Code read at origin/main and at the head of #413.\n- Cloudflare docs, Hyperdrive \"Supported databases and features\", \"Unsupported MySQL features\": \"Multi-statement queries\".\n- `void db migrate` on MySQL 8.4 with the head of #413: the output above, then `Table 'comments' already exists` on rerun.\n- Vitess docs on shard isolation and atomicity (default `MULTI` mode).\n- #413 does not change the multi-statement send. It adds the per-file transaction and the note, and the note does not cover these files. On main there is no note at all.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nhttps://claude.ai/code/session_0123r5HnanmW2VUrZ7VWDufH\n","author":{"url":"https://github.com/Brooooooklyn","@type":"Person","name":"Brooooooklyn"},"datePublished":"2026-10-14T04:05:23Z","url":"https://github.com/voidzero-dev/void/issues/414"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:defdc14a-c9ee-4379-ea5e-3464ac0ce45f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C380:26F963:C1C1A:1089E7:6AFB96EB |
| html-safe-nonce | ac3e4d109cd43acc2ab4545cecbec4f1a8b778e3dd300686399b96710e611663 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzgwOjI2Rjk2MzpDMUMxQToxMDg5RTc6NkFGQjk2RUIiLCJ2aXNpdG9yX2lkIjoiODUxOTYxNjk2ODMxNzk2NjA1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3c76a6bac6061b6fcfa85df7ee878f0be6c21b7253b9514499723d0dff50eace |
| hovercard-subject-tag | issue:5841737381 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/voidzero-dev/void/414/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8cf75872179add31f259771204aff1691309059f5e01ecfdb1db76b844946a09/voidzero-dev/void/issues/414 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8cf75872179add31f259771204aff1691309059f5e01ecfdb1db76b844946a09/voidzero-dev/void/issues/414 |
| og:image:alt | Problem A MySQL app deploys to the Void platform with void deploy. The platform applies pending migrations through the app Worker's migration handler. That handler reaches MySQL through Hyperdrive.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Brooooooklyn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4f01efe06174a5ba6342fd58e42d02295e0675bedbb465d6bef2dbaec8e46556 |
| turbo-cache-control | no-preview |
| go-import | github.com/voidzero-dev/void git https://github.com/voidzero-dev/void.git |
| octolytics-dimension-user_id | 149750581 |
| octolytics-dimension-user_login | voidzero-dev |
| octolytics-dimension-repository_id | 1164437080 |
| octolytics-dimension-repository_nwo | voidzero-dev/void |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1164437080 |
| octolytics-dimension-repository_network_root_nwo | voidzero-dev/void |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a52db8866b6543b4e83730cd6a6b1360f1a9e4dc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width