Skip to content

feat: Smart error handling with CREATE TABLE detection#23

Merged
keyamasabaya merged 0 commit into
mainfrom
develop
Dec 24, 2025
Merged

feat: Smart error handling with CREATE TABLE detection#23
keyamasabaya merged 0 commit into
mainfrom
develop

Conversation

@keyamasabaya

@keyamasabaya keyamasabaya commented Dec 24, 2025

Copy link
Copy Markdown
Owner

Session Management

  • Fix dropRestart() race condition: add session_write_close() to force
    disk write before redirect (fixes import not restarting from line 0)
  • Add new action restartFromBeginning() to restart import without DROP
  • Register restart_import route in Application.php and Request.php

CREATE TABLE Detection

  • Add FileAnalysisService::hasCreateTableFor() method
    • Scans first 10MB of SQL file for CREATE TABLE statements
    • Supports both regular and gzipped files
    • Case-insensitive pattern matching with backtick support

Smart Error UI

  • Enrich SSE error response with hasCreateTable boolean
  • Conditional error buttons based on context:
    • "Table already exists" + CREATE TABLE found → "Drop & Restart"
    • "Table already exists" + no CREATE TABLE → help message
    • "Table doesn't exist" + CREATE TABLE found → "Restart from Beginning"
    • "Table doesn't exist" + no CREATE TABLE → help message
  • Rename "Start Over (resume)" → "Resume" for clarity

Files Modified

  • src/Controllers/BigDumpController.php (dropRestart fix + new action)
  • src/Services/FileAnalysisService.php (hasCreateTableFor method)
  • src/Services/AjaxService.php (smart error UI logic)
  • src/Core/Application.php (restart_import route)
  • src/Core/Request.php (restart_import validation)

--

@keyamasabaya keyamasabaya changed the title Develop feat: Smart error handling with CREATE TABLE detection Dec 24, 2025
@keyamasabaya
keyamasabaya marked this pull request as ready for review December 24, 2025 11:18
@keyamasabaya
keyamasabaya merged this pull request into main Dec 24, 2025
1 check passed
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.

1 participant