on main help sign in
reshape/tests/remove_table.rs
44 lines 931 B history raw
1mod common;
2use common::Test;
4#[test]
5fn remove_table() {
6 let mut test = Test::new("Remove table");
8 test.first_migration(
9 r#"
10 name = "create_users_table"
12 [[actions]]
13 type = "create_table"
14 name = "users"
15 primary_key = ["id"]
17 [[actions.columns]]
18 name = "id"
19 type = "INTEGER"
20 "#,
21 );
23 test.second_migration(
24 r#"
25 name = "remove_users_table"
27 [[actions]]
28 type = "remove_table"
29 table = "users"
30 "#,
31 );
33 test.intermediate(|old_db, new_db| {
34 // Make sure inserts work against the old schema
35 old_db
36 .simple_query("INSERT INTO users(id) VALUES (1)")
37 .unwrap();
39 // Ensure the table is not accessible through the new schema
40 assert!(new_db.query("SELECT id FROM users", &[]).is_err());
41 });
43 test.run();