From b9bb84d3affa546b6d98d7516655d4febc202e24 Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Tue, 9 Dec 2008 23:18:17 +0000 Subject: [PATCH] Cope with the new ColumnDefinition. --- src/java/com/samskivert/depot/SchemaMigration.java | 14 +++++++------- .../com/samskivert/depot/impl/DepotMarshaller.java | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/java/com/samskivert/depot/SchemaMigration.java b/src/java/com/samskivert/depot/SchemaMigration.java index be0a495..de0062a 100644 --- a/src/java/com/samskivert/depot/SchemaMigration.java +++ b/src/java/com/samskivert/depot/SchemaMigration.java @@ -151,9 +151,9 @@ public abstract class SchemaMigration extends Modifier @Override protected int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { log.info("Updating type of '" + _fieldName + "' in " + _tableName); - return liaison.changeColumn(conn, _tableName, _fieldName, _newColumnDef.getType(), - _newColumnDef.isNullable(), _newColumnDef.isUnique(), - _newColumnDef.getDefaultValue()) ? 1 : 0; + return liaison.changeColumn(conn, _tableName, _fieldName, _newColumnDef.type, + _newColumnDef.nullable, _newColumnDef.unique, + _newColumnDef.defaultValue) ? 1 : 0; } protected String _fieldName, _columnName; @@ -191,13 +191,13 @@ public abstract class SchemaMigration extends Modifier protected int invoke (Connection conn, DatabaseLiaison liaison) throws SQLException { // override the default value in the column definition with the one provided ColumnDefinition defColumnDef = new ColumnDefinition( - _newColumnDef.getType(), _newColumnDef.isNullable(), - _newColumnDef.isUnique(), _defaultValue); + _newColumnDef.type, _newColumnDef.nullable, + _newColumnDef.unique, _defaultValue); // first add the column with the overridden default value if (liaison.addColumn(conn, _tableName, _fieldName, defColumnDef, true)) { // then change the column to the permanent default value - liaison.changeColumn(conn, _tableName, _fieldName, _newColumnDef.getType(), - null, null, _newColumnDef.getDefaultValue()); + liaison.changeColumn(conn, _tableName, _fieldName, _newColumnDef.type, + null, null, _newColumnDef.defaultValue); return 1; } return 0; diff --git a/src/java/com/samskivert/depot/impl/DepotMarshaller.java b/src/java/com/samskivert/depot/impl/DepotMarshaller.java index c27941a..78fabdf 100644 --- a/src/java/com/samskivert/depot/impl/DepotMarshaller.java +++ b/src/java/com/samskivert/depot/impl/DepotMarshaller.java @@ -791,8 +791,8 @@ public class DepotMarshaller // TIMESTAMP columns a value of "0000-00-00 00:00:00" regardless of whether we // explicitly provide a "DEFAULT" value for the column or not, and DATETIME columns // cannot accept CURRENT_TIME or NOW() defaults at all. - if (!coldef.isNullable() && (coldef.getType().equalsIgnoreCase("timestamp") || - coldef.getType().equalsIgnoreCase("datetime"))) { + if (!coldef.nullable && (coldef.type.equalsIgnoreCase("timestamp") || + coldef.type.equalsIgnoreCase("datetime"))) { log.info("Assigning current time to " + fmarsh.getColumnName() + "."); ctx.invoke(new Modifier.Simple() { @Override protected String createQuery (DatabaseLiaison liaison) {