feat(migrate): add SQLite to Dolt migration tooling (hq-ew1mbr.6)
Add `bd migrate --to-dolt` and `bd migrate --to-sqlite` commands for migrating between SQLite and Dolt storage backends. Features: - `--to-dolt`: Migrate from SQLite to Dolt backend - Creates backup of SQLite database before migration - Imports all issues, labels, and dependencies - Updates metadata.json to use Dolt backend - Preserves JSONL export configuration - `--to-sqlite`: Escape hatch to migrate back to SQLite - Exports all data from Dolt to new SQLite database - Updates metadata.json to use SQLite backend Both commands support: - `--dry-run` flag to preview changes - `--yes` flag for automated/scripted usage - `--json` flag for machine-readable output - Non-cgo stub for builds without CGO support This implements Part 7 (Migration Tooling) of DOLT-STORAGE-DESIGN.md. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
e74cab8c6d
commit
4e3e9d1441
40
cmd/bd/migrate_dolt_nocgo.go
Normal file
40
cmd/bd/migrate_dolt_nocgo.go
Normal file
@@ -0,0 +1,40 @@
|
||||
//go:build !cgo
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// handleToDoltMigration is a stub for non-cgo builds.
|
||||
// Dolt requires CGO, so this migration is not available.
|
||||
func handleToDoltMigration(dryRun bool, autoYes bool) {
|
||||
if jsonOutput {
|
||||
outputJSON(map[string]interface{}{
|
||||
"error": "dolt_not_available",
|
||||
"message": "Dolt backend requires CGO. This binary was built without CGO support.",
|
||||
})
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "Error: Dolt backend requires CGO\n")
|
||||
fmt.Fprintf(os.Stderr, "This binary was built without CGO support.\n")
|
||||
fmt.Fprintf(os.Stderr, "To use Dolt, rebuild with: CGO_ENABLED=1 go build\n")
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// handleToSQLiteMigration is a stub for non-cgo builds.
|
||||
// Dolt requires CGO, so this migration from Dolt is not available.
|
||||
func handleToSQLiteMigration(dryRun bool, autoYes bool) {
|
||||
if jsonOutput {
|
||||
outputJSON(map[string]interface{}{
|
||||
"error": "dolt_not_available",
|
||||
"message": "Dolt backend requires CGO. This binary was built without CGO support.",
|
||||
})
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "Error: Dolt backend requires CGO\n")
|
||||
fmt.Fprintf(os.Stderr, "This binary was built without CGO support.\n")
|
||||
fmt.Fprintf(os.Stderr, "To use Dolt, rebuild with: CGO_ENABLED=1 go build\n")
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user