Fix SQL dump uploads and connection pooling - #2
Draft
romanxmanuel wants to merge 1 commit into
Draft
Conversation
Upload, restore, and clear routes now use a single connection per operation so SET FOREIGN_KEY_CHECKS=0 actually persists across all queries. Previously each dbExecute() call could grab a different pool connection, making FK checks and session variables ineffective. Upload route: replaced fragile FK-extraction regex with single-connection FK_CHECKS=0 approach. SQL parser now expands conditional comments before matching CREATE DATABASE/USE (fixes mysqldump /*!32312 IF NOT EXISTS*/ patterns). SET statements from dumps are skipped since the connection manages its own session state. Also fixes Next.js 16 Turbopack build config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E4ugbiuYpx9mh6UCJwnoQn
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix upload failures with mysqldump files: Upload, restore, and clear routes now use a single database connection per operation so
SET FOREIGN_KEY_CHECKS=0actually persists across all queries. Previously eachdbExecute()call grabbed a random connection from the pool, making FK checks and session variables ineffective.Fix SQL parser for conditional comments:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ \basketball`now correctly extracts the database name. AddedexpandConditionalComments()to strip/*!NNNNN ... */` markers before regex matching.Skip SET statements from dumps: Session variable saves/restores from mysqldump (like
SET @saved_cs_client) are skipped since they fail across pooled connections and aren't needed — the upload connection manages its own state.Simplified upload approach: Replaced fragile FK-extraction regex with a single-connection
FOREIGN_KEY_CHECKS=0approach — tables can now be created in any order.Fix Next.js 16 build: Added
turbopack: {}config to resolve Turbopack/webpack conflict.Test plan
Generated by Claude Code