From 82f0e5f92c2df4f6bfb5e7c9ccb081190131adaa Mon Sep 17 00:00:00 2001 From: lsmith Date: Thu, 10 Jan 2008 13:19:17 +0000 Subject: [PATCH] - do not force a DEFAULT NULL on LOB fields --- lib/Doctrine/Export.php | 4 +++- lib/Doctrine/Export/Mysql.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/Export.php index 87de3850d..7c6f0efad 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/Export.php @@ -731,7 +731,9 @@ class Doctrine_Export extends Doctrine_Connection_Module */ public function getDefaultFieldDeclaration($field) { - $default = empty($field['notnull']) ? ' DEFAULT NULL' : ''; + $default = empty($field['notnull']) && !in_array($field['type'], array('clob', 'blob')) + ? ' DEFAULT NULL' : ''; + if (isset($field['default'])) { if ($field['default'] === '') { $field['default'] = null; diff --git a/lib/Doctrine/Export/Mysql.php b/lib/Doctrine/Export/Mysql.php index fc8cdcd9b..3c17590ef 100644 --- a/lib/Doctrine/Export/Mysql.php +++ b/lib/Doctrine/Export/Mysql.php @@ -512,7 +512,9 @@ class Doctrine_Export_Mysql extends Doctrine_Export */ public function getDefaultFieldDeclaration($field) { - $default = empty($field['notnull']) ? ' DEFAULT NULL' : ''; + $default = empty($field['notnull']) && !in_array($field['type'], array('clob', 'blob')) + ? ' DEFAULT NULL' : ''; + if (isset($field['default']) && ( ! isset($field['length']) || $field['length'] <= 255)) { if ($field['default'] === '') { $field['default'] = null;