migs 0.1.4

A SQL migration script collection library with compile-time registration
Documentation
//! 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");
//!
//! // Collect all registered scripts
//! let all_scripts: Vec<&Migs> = collect!();
//! ```

// Re-export inventory for use in macros
pub use inventory;

// Re-export the macros
pub use migs_macro::{collect, migs};

/// Represents a registered SQL migration script with metadata
#[derive(Debug, Clone)]
pub struct Migs {
    /// The scope/category of this migration (e.g., "init", "create", "seed")
    pub scope: &'static str,
    /// The source of this migration (file path or "<inline>")
    pub source: &'static str,
    /// The SQL content with optional {{template}} placeholders
    pub content: &'static str,
}

// Register Migs with inventory for collection
inventory::collect!(Migs);

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_migs_struct_creation() {
        let migs = Migs {
            scope: "test",
            source: "<inline>",
            content: "SELECT 1",
        };
        assert_eq!(migs.scope, "test");
        assert_eq!(migs.source, "<inline>");
        assert_eq!(migs.content, "SELECT 1");
    }
}