Skip to main content

Module migrate_backend_cmd

Module migrate_backend_cmd 

Source
Expand description

Cross-backend database migration command implementation

Handles migration between SQLite backends (copy with side table migration).

§Architecture

This module uses sqlitegraph’s GraphBackend::snapshot_export() and snapshot_import() methods for graph data migration. The wrapper only handles directory creation and returns Magellan-specific metadata.

§Side Tables

GraphBackend does NOT handle Magellan-specific side tables:

  • code_chunks - Code snippets stored in generation module
  • file_metrics, symbol_metrics - Pre-computed metrics
  • execution_log - Command execution tracking
  • ast_nodes - AST hierarchy storage
  • cfg_blocks - Control flow graph data

These must be migrated separately via direct SQL.

Structs§

BackendMigrationResult
Result of a backend migration operation
SnapshotExportMetadata
Snapshot export metadata returned by export_snapshot
SnapshotImportMetadata
Snapshot import metadata returned by import_snapshot

Enums§

BackendFormat
Database backend format
MigrationError
Errors that can occur during backend format detection

Functions§

detect_backend_format
Detect the backend format of a database file
export_snapshot
Export graph data from a backend to a snapshot directory
get_graph_counts
Get entity and edge counts from a graph backend
import_snapshot
Import graph data from a snapshot directory into a backend
migrate_side_tables
Migrate Magellan-specific side tables from source to target database
run_migrate_backend
Run a complete backend migration from source to target database
verify_import_counts
Verify that imported counts match exported counts