1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-13 18:14:07 +02:00

SQLite: Fix expressions in default values (bug #860)

This commit is contained in:
Jakub Vrana
2025-02-20 09:37:43 +01:00
parent e321a26ee5
commit f2e2c6e4ac
3 changed files with 4 additions and 2 deletions

View File

@@ -294,10 +294,11 @@ function process_field($field, $type_field) {
* @return string
*/
function default_value($field) {
global $jush;
$default = $field["default"];
return ($default === null ? "" : " DEFAULT " .
(!preg_match('~^GENERATED ~i', $default) && (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default))
? q($default) : str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", $default))
? q($default) : str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", ($jush == "sqlite" ? "($default)" : $default)))
);
}