### Eclipse Workspace Patch 1.0 #P Drupal Index: includes/database.pgsql.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.pgsql.inc,v retrieving revision 1.68 diff -u -r1.68 database.pgsql.inc --- includes/database.pgsql.inc 4 Jan 2008 09:31:48 -0000 1.68 +++ includes/database.pgsql.inc 30 Jan 2008 04:02:23 -0000 @@ -617,10 +617,17 @@ $sql .= ' NOT NULL'; } if (isset($spec['default'])) { - $default = is_string($spec['default']) ? "'". $spec['default'] ."'" : $spec['default']; - $sql .= " default $default"; + if (is_string($spec['default'])) { + if ('type' == 'datetime' && $spec['default'] == 'now()') { + $default = $spec['default']; + } else { + $default = "'". $spec['default'] ."'"; + } + } else { + $default = $spec['default']; + } + $sql .= " DEFAULT $default"; } - return $sql; } /** Index: includes/database.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.inc,v retrieving revision 1.92 diff -u -r1.92 database.inc --- includes/database.inc 8 Jan 2008 16:03:31 -0000 1.92 +++ includes/database.inc 30 Jan 2008 04:02:21 -0000 @@ -425,7 +425,9 @@ * value matters: '', '0', and 0 are all different. If you * specify '0' as the default value for a type 'int' field it * will not work because '0' is a string containing the - * character "zero", not an integer. + * character "zero", not an integer. For datetime fields you can use + * now() to specify that the database should set the current date on + * insert. * - 'length': The maximal length of a type 'varchar' or 'text' * field. Ignored for other field types. * - 'unsigned': A boolean indicating whether a type 'int', 'float' Index: includes/database.mysql-common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database.mysql-common.inc,v retrieving revision 1.16 diff -u -r1.16 database.mysql-common.inc --- includes/database.mysql-common.inc 23 Dec 2007 13:22:12 -0000 1.16 +++ includes/database.mysql-common.inc 30 Jan 2008 04:02:21 -0000 @@ -177,9 +177,15 @@ if (isset($spec['default'])) { if (is_string($spec['default'])) { - $spec['default'] = "'". $spec['default'] ."'"; + if ('type' == 'datetime' && $spec['default'] == 'now()') { + $default = $spec['default']; + } else { + $default = "'". $spec['default'] ."'"; + } + } else { + $default = $spec['default']; } - $sql .= ' DEFAULT '. $spec['default']; + $sql .= " DEFAULT $default"; } if (empty($spec['not null']) && !isset($spec['default'])) {