mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#713 - DB Migration - When change is from Not Null to Null ... this migration is duplicated in subsequent migration generation
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user