mirror of
https://github.com/ilyakooo0/reshape.git
synced 2024-11-25 23:13:29 +03:00
9cac25299a
This has the added benefit of removing the need for builders and the derive_builder dependency.
43 lines
914 B
Rust
43 lines
914 B
Rust
mod common;
|
|
use common::Test;
|
|
|
|
#[test]
|
|
fn remove_table() {
|
|
let mut test = Test::new("Remove table");
|
|
|
|
test.first_migration(
|
|
r#"
|
|
name = "create_users_table"
|
|
|
|
[[actions]]
|
|
type = "create_table"
|
|
name = "users"
|
|
primary_key = ["id"]
|
|
|
|
[[actions.columns]]
|
|
name = "id"
|
|
type = "INTEGER"
|
|
"#,
|
|
);
|
|
|
|
test.second_migration(
|
|
r#"
|
|
name = "remove_users_table"
|
|
|
|
[[actions]]
|
|
type = "remove_table"
|
|
table = "users"
|
|
"#,
|
|
);
|
|
|
|
test.intermediate(|old_db, new_db| {
|
|
// Make sure inserts work against the old schema
|
|
old_db
|
|
.simple_query("INSERT INTO users(id) VALUES (1)")
|
|
.unwrap();
|
|
|
|
// Ensure the table is not accessible through the new schema
|
|
assert!(new_db.query("SELECT id FROM users", &[]).is_err());
|
|
});
|
|
}
|