feat: add barrel

This commit is contained in:
2021-01-02 18:49:02 +08:00
parent 42a261af55
commit 8b70dfa145
3 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
use barrel::{types, Migration};
use barrel::backend::Pg;
use barrel::backend::MySql;
use barrel::backend::Sqlite;
fn main() {
let mut m = Migration::new();
m.create_table("users", |t| {
t.add_column("name", types::varchar(255));
t.add_column("age", types::integer().nullable(true));
t.add_column("owns_plushy_sharks", types::boolean().nullable(true));
});
println!("{}", m.make::<Pg>());
println!("{}", m.make::<MySql>());
println!("{}", m.make::<Sqlite>());
}