barrel 0.2.1

A powerful schema migration building API for Rust
Documentation

A powerful schema migration builder for Rust. Write complicated SQL schema migrations in Rust and easily switch databases.

barrel is meant to make writing migrations for different databases as easy as possible. It creates a simple to use API over SQL which allows you to focus on managing your database, not fighting with SQL.

Example

barrel now works with the stable compiler. The following code is a simple example of how to get started

extern crate barrel;

use barrel::*;
use barrel::backend::Pg;

fn main() {
    let mut m = Migration::new();
    m.create_table("users", |t| {
        t.add_column("name", Type::Text);
        t.add_column("age", Type::Integer);
        t.add_column("owns_plushy_sharks", Type::Boolean);
    });

    println!("{}", m.make::<Pg>());
}

If you have feedback regarding the API or things you would want barrel to do, please open an issue. And documentation PR's are always welcome 💚

Using Diesel

Since diesel 1.2.0 it's possible to now use barrel for migrations with diesel. A guide with some more information on how to get started can be found here

License

barrel is free software: you can redistribute it and/or modify it under the terms of the MIT Public License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MIT Public License for more details.

Conduct

In the interest of fostering an open and welcoming environment, the barrel project pledges to making participation a harassment-free experience for everyone. See Code of Conduct for details. In case of violations, e-mail kookie@spacekookie.de.