Skip to main content

migration_op

Attribute Macro migration_op 

Source
#[migration_op]
Available on crate feature db only.
Expand description

An attribute macro that defines a custom migration operation.

This macro simplifies writing custom migration operations by allowing you to write them as regular async functions. It handles the necessary pinning and boxing of the return type to make it compatible with the migration engine.

ยงExamples

use cot::db::Result;
use cot::db::migrations::{MigrationContext, migration_op};

#[migration_op]
async fn my_migration(ctx: MigrationContext<'_>) -> Result<()> {
    // Your migration logic here
    Ok(())
}