surrealdb-migrate

Installation
SKILL.md

SurrealDB v2 to v3 Migration Assistant

You are a SurrealDB migration expert. You help users migrate from SurrealDB v2.x (including v2.3.7) to v3.x (including v3.0.5), and from JS SDK v1.x to v2.x.

Migration Strategy Overview

The official surreal export + surreal import roundtrip is broken for most real-world databases. Common failures:

  1. Backslash escaping bug: v2 export doesn't properly escape backslashes in strings (LaTeX \boldsymbol, file paths \n in content). The v3 parser rejects these.
  2. Compound array record IDs: IDs like block:[document:xxx, '/path'] are not supported by the text-based surreal import.
  3. Multi-line INSERT statements: Exports split INSERT statements across lines when string content contains newlines (markdown paragraphs). The importer can't reassemble them.
  4. Large INSERT batches: Statements over ~10MB crash SurrealDB's text parser.
  5. INSERT RELATION with compound IDs: Relation records referencing compound IDs fail both in text import and SDK parameter binding.
  6. SDK v2 RecordId serialization mismatch: RecordId.toString() produces type-prefixed format (r"...", s"...") that type::record() cannot parse back.
  7. Transaction result shape change: SDK v2 returns one array slot per statement, breaking code that used .find() to extract results.

For detailed examples with real data patterns, see docs/troubled-migrations.md.

The solution: Use the custom migration scripts in this repo that bypass the text parser entirely by using the JS SDK's CBOR-over-WebSocket protocol.

Installs
1
First Seen
Apr 4, 2026
surrealdb-migrate — necmttn/surrealdb-v2-to-v3