My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/development/libs/barrel/examples/user_index.rs

17 lines
507 B

use barrel::{types, Migration};
fn main() {
let mut m = Migration::new();
m.create_table("users", |t| {
t.add_column("first_name", types::varchar(64).nullable(false));
t.add_column("last_name", types::varchar(64).nullable(false));
t.add_column("birthday", types::date().nullable(false));
t.add_index(
"names",
types::index(vec!["first_name", "last_name"])
.unique(true)
.nullable(false),
);
});
}