Expand description
Migs - A SQL migration script collection library
This library provides macros for registering SQL scripts at compile time and collecting them into a registry.
§Example
use migs::{migs, collect, Migs};
// Register inline SQL (scope defaults to "init")
migs!(sql = "CREATE TABLE users (id INT)");
// Register inline SQL with explicit scope
migs!(sql = "CREATE TABLE {{name}} (id INT)", scope = "create");
// Register SQL with explicit scope and order
// Note: Duplicate orders within the same scope will cause a compile error
migs!(sql = "CREATE INDEX idx_users ON users(id)", scope = "create", order = 1);
// Collect all registered scripts
let all_scripts: Vec<&Migs> = collect!();Re-exports§
pub use inventory;
Macros§
- collect
- The collect! macro returns a Vec<&’static Migs> with all registered scripts
- migs
- The migs! macro registers a SQL script at compile time Usage:
Structs§
- Migs
- Represents a registered SQL migration script with metadata