Skip to main content

Crate arcadedb_migrate

Crate arcadedb_migrate 

Source
Expand description

Schema migration manager for ArcadeDB. Declarative sync (diff desired .sql schema vs. live schema:types, apply reconciliation DDL) + sequential override migrations for renames/backfills the diff can’t infer + a seed phase. State recorded in the database.

The complete model — directory layout, two-phase apply, the four integrity layers, baseline rules, and the engine realities — lives in one place: docs/migration-model.md (repo root). The module docs below cover their own slice and link outward rather than re-explaining.

Overrides apply in two phases (copy-in-explicit-transaction with in-tx verification, then journaled destructive/swap statements) because ArcadeDB auto-commits DDL — see migrator for the model.

This crate depends on arcadedb_protocol for the gRPC wire layer. The migrate binary (cargo run -p arcadedb-migrate --bin arcadedb-migrate) is a generic entry point any app can invoke with its schema directory.

§Quick start

use arcadedb_migrate::schema::{Migrator, DropStrategy};
use arcadedb_protocol::ArcadeDbClient;

let client = ArcadeDbClient::connect("127.0.0.1:50051", "root", "password", "mydb").await?;
let migrator = Migrator::new(client, "mydb").await?;

// Parse database/schema_arcadedb/*.sql + seed/*.sql, diff against the live
// DB, apply.
let report = migrator.sync_dir("database/schema_arcadedb", DropStrategy::Never).await?;
println!("{report}");

Re-exports§

pub use error::MigrateError;
pub use error::Result;

Modules§

cli
Generic schema-migration entry point for any app using ArcadeDB.
error
The crate-facing error type: every fallible schema / migrator / cli call returns Result<T, MigrateError> instead of an opaque error. Matching on the failure category distinguishes I/O, parse, server, lock, and integrity errors, and the typed ArcadeDbError source of any server-side failure stays inspectable.
migrator
The migration orchestrator — owns the DB connection + bookkeeping, computes plans, applies them, and records state.
schema
The schema engine + migration orchestrator for ArcadeDB.