on main help sign in
Use CreateTableBuilder in failure test
5691ad2fabianlindfors
tests/failure.rs+20−22
@@ -1,4 +1,4 @@
1−use reshape::migrations::{AddColumn, Column, CreateTable, Migration};
1+use reshape::migrations::{AddColumn, Column, ColumnBuilder, CreateTableBuilder, Migration};
2
2
3mod common;
3mod common;
4
4
@@ -6,27 +6,25 @@ mod common;
6fn invalid_migration() {
6fn invalid_migration() {
7 let (mut reshape, mut old_db, mut new_db) = common::setup();
7 let (mut reshape, mut old_db, mut new_db) = common::setup();
8
8
9− let create_users_table = Migration::new("create_users_table", None).with_action(CreateTable {
9+ let create_users_table = Migration::new("create_users_table", None).with_action(
10+ CreateTableBuilder::default()
10− name: "users".to_string(),
11+ .name("users")
11− primary_key: vec!["id".to_string()],
12+ .primary_key(vec!["id".to_string()])
12− foreign_keys: vec![],
13− columns: vec![
13+ .columns(vec![
14− Column {
14+ ColumnBuilder::default()
15− name: "id".to_string(),
15+ .name("id")
16− data_type: "SERIAL".to_string(),
16+ .data_type("INTEGER")
17− nullable: true,
17+ .build()
18+ .unwrap(),
18− default: None,
19+ ColumnBuilder::default()
19− generated: None,
20− },
21− Column {
22− name: "name".to_string(),
20+ .name("name")
23− data_type: "TEXT".to_string(),
21+ .data_type("TEXT")
24− nullable: false,
22+ .build()
25− default: None,
23+ .unwrap(),
26− generated: None,
24+ ])
27− },
25+ .build()
28− ],
26+ .unwrap(),
29− });
27+ );
30 let add_first_column = Migration::new("add_first_column", None).with_action(AddColumn {
28 let add_first_column = Migration::new("add_first_column", None).with_action(AddColumn {
31 table: "users".to_string(),
29 table: "users".to_string(),
32 column: Column {
30 column: Column {