barrel 0.0.1

A powerful schema builder API for Diesel ORM
Documentation

Barrel Logo

Build Status Coverage Status

A schema building API, using Diesel as a backend and integrated query builder. Write SQL schema migrations in Rust!

Example

The API was recently completely changed to potentially easily allow different database backends to be used. The current iteration of the API can be seen below. Some of the functions might not fully work yet or need tweaking. In fact, a lot of the functions haven't been properly hooked up yet 😅

extern crate barrel;

use barrel::{Schema, Table};
use barrel::generators::postgres::*;

fn main() {
    let mut sql = Schema::<PGSQL>::new();
    sql.create_table("users", |t: &mut Table<PGSQL>| {
        t.increments();
        t.string("username");
        t.integer("plushy_sharks_owned");
    });

    println!("{}", sql.exec());
    // create table "users" ("id" serial primary key, "username" varchar(255), "plushy_sharks_owned" int)
}

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 💚