Skip to content

Commit

Permalink
align h2 datatypes better.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Mar 28, 2011
1 parent 4d812bb commit 5666c54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Expand Up @@ -362,11 +362,18 @@ public List compareColumns(Table sourceTable,
boolean sizeMatters = _platformInfo.hasSize(sourceColumn.getTypeCode());
boolean scaleMatters = _platformInfo.hasPrecisionAndScale(sourceColumn.getTypeCode());

String targetSize = targetColumn.getSize();
if (targetSize == null) {
Integer defaultSize = _platformInfo.getDefaultSize(_platformInfo.getTargetJdbcType(targetColumn.getTypeCode()));
if (defaultSize != null) {
targetSize = defaultSize.toString();
}
}
if (sizeMatters &&
!StringUtils.equals(sourceColumn.getSize(), targetColumn.getSize()))
!StringUtils.equals(sourceColumn.getSize(), targetSize))
{
if (_log.isDebugEnabled()) {
_log.debug("The " + sourceColumn.getName() + " column on the " + sourceTable.getName() + " table changed size from (" + sourceColumn.getSizeAsInt() + ","+sourceColumn.getScale() + ") to (" + targetColumn.getSizeAsInt() + ","+targetColumn.getScale() + ")");
_log.debug("The " + sourceColumn.getName() + " column on the " + sourceTable.getName() + " table changed size from (" + sourceColumn.getSizeAsInt() + ") to (" + targetColumn.getSizeAsInt() + ")");
}
changes.add(new ColumnSizeChange(sourceTable, sourceColumn, targetColumn.getSizeAsInt(), targetColumn.getScale()));
}
Expand Down
Expand Up @@ -60,13 +60,12 @@ public H2Platform() {
info.addNativeTypeMapping(Types.STRUCT, "BINARY", Types.BINARY);
info.addNativeTypeMapping(Types.DATALINK, "BINARY", Types.BINARY);

info.addNativeTypeMapping(Types.BIT, "BOOLEAN", Types.BIT);
info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.TINYINT);
info.addNativeTypeMapping(Types.SMALLINT, "SMALLINT", Types.SMALLINT);
info.addNativeTypeMapping(Types.DECIMAL, "DECIMAL", Types.DECIMAL);
info.addNativeTypeMapping(Types.BIT, "BOOLEAN", Types.BIT);;
info.addNativeTypeMapping(Types.NUMERIC, "DECIMAL", Types.DECIMAL);
info.addNativeTypeMapping(Types.BINARY, "BINARY", Types.BINARY);
info.addNativeTypeMapping(Types.BLOB, "BLOB", Types.BLOB);
info.addNativeTypeMapping(Types.CLOB, "CLOB", Types.CLOB);
info.addNativeTypeMapping(Types.LONGVARCHAR, "VARCHAR", Types.VARCHAR);
info.addNativeTypeMapping(Types.FLOAT, "DOUBLE", Types.DOUBLE);
info.addNativeTypeMapping(Types.JAVA_OBJECT, "OTHER");

Expand Down

0 comments on commit 5666c54

Please sign in to comment.