Attribute Macro db_up::migrations
source · #[migrations]
Expand description
Attribute macro for automatically generating a db_up::MigrationStore
The macro takes one required literal string parameter representing the directory containing
the migration files. Each file must be named like V<version>_<name>.sql
, where <version>
is a valid integer and <name>
is some name describing what the migration does.
Example:
ⓘ
use db_up_codegen::migrations;
#[migrations("examples/migrations/")]
struct Migrations {}
pub fn main() {
let migration_store = Migrations {};
println!("migrations: {:?}", migration_store.changelogs());
}