Derive Macro MigrationSource

Source
#[derive(MigrationSource)]
{
    // Attributes available to this derive:
    #[tern]
}
Expand description

MigrationSource does the work of collecting all of the migrations, sorting them, unifying SQL and Rust migrations under a common interface by implementing Migration, and then exposing methods to return an ordered subset of them to be used in a given operation. It has one required attribute and one optional attribute.

  • source is a required macro attribute. It is the location of the migration files relative to the project root (i.e., CARGO_MANIFEST_DIR).

ยงUsage

use tern::{SqlxPgExecutor, MigrationSource};

#[derive(MigrationSource)]
#[tern(source = "src/migrations")]
pub struct MyContext {
    #[tern(executor_via)]
    executor: SqlxPgExecutor,
}