#713 - DB Migration - When change is from Not Null to Null ... this migration is duplicated in subsequent migration generation

This commit is contained in:
Robin Bygrave
2016-05-18 21:04:36 +12:00
parent a1a48dac2c
commit cb51ea4238
2 changed files with 38 additions and 0 deletions
@@ -58,6 +58,37 @@ public class MColumnTest {
assertThat(alterColumn.getDefaultValue()).isNull();
}
@Test
public void diffNull() throws Exception {
ModelDiff diff = diff();
MColumn newCol = basic();
newCol.setNotnull(false);
MColumn baseCol = basic();
baseCol.setNotnull(true);
baseCol.compare(diff, table, newCol);
assertChanges(diff);
AlterColumn alterColumn = getAlterColumn(diff);
assertThat(alterColumn.isNotnull()).isEqualTo(false);
}
@Test
public void applyNotNull_expect_notNull() throws Exception {
MColumn newCol = basic();
newCol.setNotnull(true);
AlterColumn alterColumn = new AlterColumn();
alterColumn.setNotnull(Boolean.FALSE);
newCol.apply(alterColumn);
assertThat(newCol.isNotnull()).isFalse();
}
@Test
public void diffCheckAdd() throws Exception {