db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r493956 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/alteration/ModelComparator.java
Date Mon, 08 Jan 2007 05:27:18 GMT
Author: tomdz
Date: Sun Jan  7 21:27:17 2007
New Revision: 493956

URL: http://svn.apache.org/viewvc?view=rev&rev=493956
Log:
Fixed a bug in the alteration algorithm

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/alteration/ModelComparator.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/alteration/ModelComparator.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/java/org/apache/ddlutils/alteration/ModelComparator.java?view=diff&rev=493956&r1=493955&r2=493956
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/alteration/ModelComparator.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/alteration/ModelComparator.java Sun Jan
 7 21:27:17 2007
@@ -356,11 +356,17 @@
             changes.add(new ColumnDataTypeChange(sourceTable, sourceColumn, targetColumn.getTypeCode()));
         }
 
-        boolean sizeMatters = _platformInfo.hasSize(sourceColumn.getTypeCode());
+        boolean sizeMatters  = _platformInfo.hasSize(sourceColumn.getTypeCode());
+        boolean scaleMatters = _platformInfo.hasPrecisionAndScale(sourceColumn.getTypeCode());
 
-        if ((sizeMatters &&
-            (!StringUtils.equals(sourceColumn.getSize(), targetColumn.getSize())) ||
-             sourceColumn.getScale() != targetColumn.getScale()))
+        if (sizeMatters &&
+            !StringUtils.equals(sourceColumn.getSize(), targetColumn.getSize()))
+        {
+            changes.add(new ColumnSizeChange(sourceTable, sourceColumn, targetColumn.getSizeAsInt(),
targetColumn.getScale()));
+        }
+        else if (scaleMatters &&
+            (!StringUtils.equals(sourceColumn.getSize(), targetColumn.getSize()) ||
+             (sourceColumn.getScale() != targetColumn.getScale())))
         {
             changes.add(new ColumnSizeChange(sourceTable, sourceColumn, targetColumn.getSizeAsInt(),
targetColumn.getScale()));
         }



Mime
View raw message