Skip to main content

Crate overshift

Crate overshift 

Source
Expand description

overshift — shared migration engine for the overrealdb ecosystem.

Manages both declarative schema (re-applied with DEFINE ... OVERWRITE) and imperative migrations (versioned, checksummed, one-shot) for SurrealDB.

§Usage

use surrealdb::engine::any;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let db = any::connect("ws://localhost:8000").await?;

    let manifest = overshift::Manifest::load("surql/")?;

    // Preview what will happen (dry-run)
    let plan = overshift::plan(&db, &manifest).await?;
    plan.print();

    // Apply migrations + schema
    let result = plan.apply(&db).await?;
    println!("Applied {} migrations, {} modules", result.applied_migrations, result.applied_modules);

    Ok(())
}

Re-exports§

pub use error::Error;
pub use error::Result;
pub use lock::MigrationLock;Deprecated
pub use lock::SurrealLock;
pub use manifest::Manifest;
pub use manifest::ManifestBuilder;
pub use migration::AppliedMigration;
pub use migration::Migration;
pub use migration::compute_checksum;
pub use plan::ApplyResult;
pub use plan::Plan;
pub use plan::RollbackResult;
pub use plan::plan;
pub use plan::rollback;
pub use schema::SchemaModule;

Modules§

changelog
Changelog recording — audit trail of all applied migrations and schema modules.
error
lock
Distributed lock for coordinating operations across multiple instances.
manifest
migration
plan
Plan and apply — the core migration engine workflow.
schema
snapshot
Schema snapshot generation — produces generated/current.surql.
validate
Schema validation — verify that all expected functions exist in the database.