vespertide_macro/
lib.rs

1mod options;
2mod runtime;
3
4pub use options::MigrationOptions;
5pub use runtime::{MigrationError, run_migrations};
6
7/// Zero-runtime migration entry point.
8#[macro_export]
9macro_rules! vespertide_migration {
10    ($pool:expr $(, $key:ident = $value:expr )* $(,)?) => {{
11        async {
12            let mut __version_table: &str = "vespertide_version";
13
14            $(
15                match stringify!($key) {
16                    "version_table" => __version_table = $value,
17                    _ => compile_error!("unsupported option for vespertide_migration!"),
18                }
19            )*
20
21            $crate::run_migrations(
22                $pool,
23                $crate::MigrationOptions {
24                    version_table: __version_table.to_string(),
25                },
26            )
27            .await
28        }
29    }};
30}