Let's not run this MySQL atrocity unless absolutely necessary.

This commit is contained in:
Par Winzell
2009-09-22 21:33:42 +00:00
parent 681f420b8f
commit 4a552b29bc
@@ -765,8 +765,9 @@ public class DepotMarshaller<T extends PersistentRecord>
// TIMESTAMP columns a value of "0000-00-00 00:00:00" regardless of whether we // 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 // explicitly provide a "DEFAULT" value for the column or not, and DATETIME columns
// cannot accept CURRENT_TIME or NOW() defaults at all. // cannot accept CURRENT_TIME or NOW() defaults at all.
if (!coldef.nullable && (coldef.type.equalsIgnoreCase("timestamp") || if (!coldef.nullable && coldef.defaultValue.length() == 0 &&
coldef.type.equalsIgnoreCase("datetime"))) { (coldef.type.equalsIgnoreCase("timestamp") ||
coldef.type.equalsIgnoreCase("datetime"))) {
log.info("Assigning current time to " + fmarsh.getColumnName() + "."); log.info("Assigning current time to " + fmarsh.getColumnName() + ".");
ctx.invoke(new Modifier.Simple() { ctx.invoke(new Modifier.Simple() {
@Override protected String createQuery (DatabaseLiaison liaison) { @Override protected String createQuery (DatabaseLiaison liaison) {