Sir Eel
Sir Eel is a lightweight and easy-to-use database migration tool for SurrealDB. It provides a simple CLI and programmatic API to help you manage your database schema changes.

Features
- Simple, file-based migrations
- CLI for generating and running migrations
- Programmatic API for more complex workflows
- Lightweight and easy to integrate
CLI
Installation
Install the CLI using cargo:
Usage
init
Initialize a sir-eel.toml configuration file in your project root.
This will create a sir-eel.toml file with the following contents:
[]
= "rocksdb://data"
= "mydatabase"
= "mynamespace"
= "migrations"
Update the values in this file to reflect your needs. Note that the default persistence layer for SurrealDB supported by the CLI is RocksDB.
generate
Generate a new migration file.
This will create a new file in the migrations_dir with a timestamp and
the provided name, e.g.,
migrations/20231027123456_create_users_table.surql.
migrate
Apply all pending migrations.
You can also perform a dry run to see which migrations would be applied without actually running them:
Programmatic API
Sir Eel can also be used programmatically in your Rust applications.
Example
use ;
async
API
Migrator::new(config: Config): Creates a newMigratorinstance.migrator.generate(name: &str): Generates a new migration file.migrator.run(): Runs all pending migrations.migrator.pending_migrations(): Returns a list of pending migrations.