Skip to content

Fix SQL dump uploads and connection pooling - #2

Draft
romanxmanuel wants to merge 1 commit into
mainfrom
claude/mysql-procedures-line-fix-IN6XX
Draft

Fix SQL dump uploads and connection pooling#2
romanxmanuel wants to merge 1 commit into
mainfrom
claude/mysql-procedures-line-fix-IN6XX

Conversation

@romanxmanuel

Copy link
Copy Markdown
Owner

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=0 actually persists across all queries. Previously each dbExecute() 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=0 approach — tables can now be created in any order.

  • Fix Next.js 16 build: Added turbopack: {} config to resolve Turbopack/webpack conflict.

Test plan

  • Upload a mysqldump file (e.g. basketball.sql with foreign keys, conditional comments, LOCK/UNLOCK TABLES)
  • Verify tables are created and data is loaded correctly
  • Test "Sample data" restore button
  • Test "Clear DB" button
  • Run queries against uploaded database
  • Test stored procedures still work
  • Verify Vercel deployment succeeds

Generated by Claude Code

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
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sql-playground Ready Ready Preview Aug 13, 2026 1:32am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants