mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-21 08:56:22 +00:00
DbMigration: Do only real type changes
This commit is contained in:
+13
-1
@@ -723,7 +723,7 @@ public class BaseTableDdl implements TableDdl {
|
||||
dropCheckConstraint(writer, alterColumn, alterColumn.getCheckConstraintName());
|
||||
}
|
||||
|
||||
if (hasValue(alterColumn.getType())
|
||||
if (typeChange(alterColumn)
|
||||
|| hasValue(alterColumn.getDefaultValue())
|
||||
|| alterColumn.isNotnull() != null) {
|
||||
alterColumn(writer, alterColumn);
|
||||
@@ -735,6 +735,18 @@ public class BaseTableDdl implements TableDdl {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean typeChange(AlterColumn alterColumn) {
|
||||
if (!hasValue(alterColumn.getType())) {
|
||||
return false;
|
||||
}
|
||||
// check, if we have really a type change for that platform
|
||||
// When specifying @Column("db2;clob(64K)") this would not alter
|
||||
// other platforms from "String" to "String" for example
|
||||
String currentType = platformDdl.convert(alterColumn.getCurrentType());
|
||||
String type = platformDdl.convert(alterColumn.getType());
|
||||
return !type.equals(currentType);
|
||||
}
|
||||
|
||||
private void alterColumnComment(DdlWrite writer, AlterColumn alterColumn) {
|
||||
platformDdl.addColumnComment(writer.applyPostAlter(), alterColumn.getTableName(), alterColumn.getColumnName(), alterColumn.getComment());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user