Skip to content

Commit

Permalink
Allow to default timestamp column to CURRENT_TIMESTAMP
Browse files Browse the repository at this point in the history
  • Loading branch information
DaazKu committed Jan 9, 2018
1 parent d4039e2 commit 09c0ffd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions library/database/class.mysqlstructure.php
Expand Up @@ -792,8 +792,14 @@ protected function _defineColumn($column, $newColumnName = null) {
$return .= ' null';
}

if (!is_null($column->Default) && $column->Type !== 'timestamp') {
$return .= " default ".self::_quoteValue($column->Default);
if (!is_null($column->Default)) {
if ($column->Type !== 'timestamp') {
$return .= " default ".self::_quoteValue($column->Default);
} else {
if (in_array(strtolower($column->Default), ['current_timestamp', 'current_timestamp()'])) {
$return .= " default ".$column->Default;
}
}
}

if ($column->AutoIncrement) {
Expand Down

0 comments on commit 09c0ffd

Please sign in to comment.