← Back to Dashboard
#9349 D1 export/import fails with foreign key errors
Recommendation:KEEP OPEN
Difficulty:medium
Reasoning:
Related to #5683; labeled blocked/internal; D1 team engaged
Suggested Action:
Await D1 team response on fix approach
Analysis Report
Issue Review: cloudflare/workers-sdk#9349
Summary
D1 export produces SQL that fails on local import due to foreign key constraint errors from incorrect statement ordering.
Findings
- Created: 2025-05-23
- Updated: 2025-11-25
- Version: wrangler 4.16.1 → 4.61.0
- Component: wrangler (D1)
- Labels: bug, d1, blocked, internal, awaiting Cloudflare response
- Comments: 7
Key Evidence
- Export includes INSERT statements before all CREATE TABLEs are executed
- Error:
no such table: main.User: SQLITE_ERROR - Related to #5683 (same underlying issue)
- Workarounds:
- Export with
--no-schema, apply migrations first, then import data - Use
PRAGMA defer_foreign_keys=ON;at start andOFF;at end - Manual SQL reordering
- Export with
- Maintainer @petebacondarwin engaged, asked D1 team about approach
- Labeled "blocked" and "internal" - awaiting D1 team response
Recommendation
Status: KEEP OPEN
Reasoning: This is a confirmed bug already tracked with D1 team. The labels indicate it's blocked on internal platform work. Multiple workarounds exist but the core export functionality should be fixed.
Action: Await D1 team response on whether to fix export ordering or pragma handling. Keep tracking internally.
Suggested Comment
N/A - Maintainer engaged and tracking with D1 team.
Notes & Feedback (0)
No notes yet.