1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-25 07:20:56 +02:00

Support current_timestamp() as default of time fields (bug #572)

This commit is contained in:
Jakub Vrana
2018-01-23 08:36:11 +01:00
parent 43ccfcef8f
commit 72aa3c5127
2 changed files with 2 additions and 1 deletions

View File

@@ -198,7 +198,7 @@ function process_field($field, $type_field) {
process_type($type_field),
($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp
(isset($default) ? " DEFAULT " . (
(preg_match('~time~', $field["type"]) && preg_match('~^CURRENT_TIMESTAMP$~i', $default))
(preg_match('~time~', $field["type"]) && preg_match('~^CURRENT_TIMESTAMP(\(\))?$~i', $default))
|| ($jush == "sqlite" && preg_match('~^CURRENT_(TIME|TIMESTAMP|DATE)$~i', $default))
|| ($field["type"] == "bit" && preg_match("~^([0-9]+|b'[0-1]+')\$~", $default))
|| ($jush == "pgsql" && preg_match("~^[a-z]+\\(('[^']*')+\\)\$~", $default))