[][src]Crate movine

Movine provides a library implementation for integration with codebases. This lets you easily run migrations at the startup of the application.

Example

use movine::{Movine, Config};
use movine::errors::Error;

fn main() -> Result<(), Error> {
    std::env::set_var("SQLITE_FILE", ":memory:");
    let config = Config::load(&"movine.toml")?;
    let mut conn = config.into_sqlite_conn()?;
    let mut movine = Movine::new(&mut conn);
    /// Note: Normally you would catch the error, however due to the doc-test
    /// nature of this example, there is no migration directory so this command
    /// will fail.
    //movine.up()?;
    movine.up();
    Ok(())
}

Or if you want to provide your own connection

use movine::{Movine, Config};
use movine::errors::Error;

fn main() -> Result<(), Error> {
    let mut conn = rusqlite::Connection::open(":memory:")?;
    let mut movine = Movine::new(&mut conn);

    /// Note: Normally you would catch the error, however due to the doc-test
    /// nature of this example, there is no migration directory so this command
    /// will fail.
    //movine.up()?;
    movine.up();
    Ok(())
}

Re-exports

pub use adaptor::DbAdaptor;
pub use config::Config;

Modules

adaptor
config
errors

Structs

Movine