#1937 - When add a new col with @DbComment in Entity,the DbMigration does not generate comment ddl

This commit is contained in:
rob bygrave
2020-02-17 14:19:19 +13:00
parent cbaaad89ab
commit 171d1a19f4
2 changed files with 20 additions and 0 deletions
@@ -19,6 +19,7 @@ import java.io.IOException;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
public class BaseTableDdlTest {
@@ -98,6 +99,21 @@ public class BaseTableDdlTest {
assertThat(ddl).contains("comment on column mytab.acol is 'my comment'");
}
@Test
public void alterTableAddColumnWithComment() throws IOException {
BaseTableDdl ddl = new BaseTableDdl(serverConfig, h2ddl);
DdlWrite write = new DdlWrite();
Column column = new Column();
column.setName("my_column");
column.setComment("some comment");
column.setType("int");
ddl.alterTableAddColumn(write.apply(), "my_table", column, false, false);
assertEquals(
"alter table my_table add column my_column int;\n" +
"comment on column my_table.my_column is 'some comment';\n", write.apply().getBuffer());
}
@Test
public void testAddTableComment() throws IOException {