on main help sign in
reshape/tests/create_enum.rs
41 lines 721 B history raw
1mod common;
2use common::Test;
4#[test]
5fn create_enum() {
6 let mut test = Test::new("Create enum");
8 test.first_migration(
9 r#"
10 name = "create_enum_and_table"
12 [[actions]]
13 type = "create_enum"
14 name = "mood"
15 values = ["happy", "ok", "sad"]
17 [[actions]]
18 type = "create_table"
19 name = "updates"
20 primary_key = ["id"]
22 [[actions.columns]]
23 name = "id"
24 type = "INTEGER"
26 [[actions.columns]]
27 name = "status"
28 type = "mood"
29 "#,
30 );
32 test.after_first(|db| {
33 // Valid enum values should succeed
34 db.simple_query(
35 "INSERT INTO updates (id, status) VALUES (1, 'happy'), (2, 'ok'), (3, 'sad')",
36 )
37 .unwrap();
38 });
40 test.run();