()
| 1504 | |
| 1505 | #[test] |
| 1506 | fn auto_migration_errors() { |
| 1507 | let mut old_builder = RawModuleDefV9Builder::new(); |
| 1508 | |
| 1509 | let foo2_ty = AlgebraicType::sum([ |
| 1510 | ("foo21", AlgebraicType::Bool), |
| 1511 | ("foo22", AlgebraicType::U32), |
| 1512 | ("foo23", AlgebraicType::U32), |
| 1513 | ]); |
| 1514 | let foo2_refty = old_builder.add_algebraic_type([], "foo2", foo2_ty.clone(), true); |
| 1515 | let foo_ty = AlgebraicType::product([ |
| 1516 | ("foo1", AlgebraicType::String), |
| 1517 | ("foo2", foo2_refty.into()), |
| 1518 | ("foo3", AlgebraicType::I32), |
| 1519 | ]); |
| 1520 | let foo_refty = old_builder.add_algebraic_type([], "foo", foo_ty.clone(), true); |
| 1521 | let sum1_ty = AlgebraicType::sum([ |
| 1522 | ("foo", AlgebraicType::array(foo_refty.into())), |
| 1523 | ("bar", AlgebraicType::U128), |
| 1524 | ]); |
| 1525 | let sum1_refty = old_builder.add_algebraic_type([], "sum1", sum1_ty.clone(), true); |
| 1526 | |
| 1527 | let prod1_ty = AlgebraicType::product([ |
| 1528 | ("baz", AlgebraicType::Bool), |
| 1529 | // We'll remove this field. |
| 1530 | ("qux", AlgebraicType::Bool), |
| 1531 | ]); |
| 1532 | let prod1_refty = old_builder.add_algebraic_type([], "prod1", prod1_ty.clone(), true); |
| 1533 | |
| 1534 | old_builder |
| 1535 | .build_table_with_new_type( |
| 1536 | "Apples", |
| 1537 | ProductType::from([ |
| 1538 | ("id", AlgebraicType::U64), |
| 1539 | ("name", AlgebraicType::String), |
| 1540 | ("sum1", sum1_refty.into()), |
| 1541 | ("prod1", prod1_refty.into()), |
| 1542 | ("count", AlgebraicType::U16), |
| 1543 | ]), |
| 1544 | true, |
| 1545 | ) |
| 1546 | .with_index(btree(0), "id_index") |
| 1547 | .with_unique_constraint([1, 2]) |
| 1548 | .with_index_no_accessor_name(btree([1, 2])) |
| 1549 | .with_type(TableType::User) |
| 1550 | .finish(); |
| 1551 | |
| 1552 | old_builder |
| 1553 | .build_table_with_new_type( |
| 1554 | "Bananas", |
| 1555 | ProductType::from([ |
| 1556 | ("id", AlgebraicType::U64), |
| 1557 | ("name", AlgebraicType::String), |
| 1558 | ("count", AlgebraicType::U16), |
| 1559 | ]), |
| 1560 | true, |
| 1561 | ) |
| 1562 | .finish(); |
| 1563 |
nothing calls this directly
no test coverage detected
searching dependent graphs…