1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-11 00:54:08 +02:00

MySQL: Allow setting default values of text column

This commit is contained in:
Jakub Vrana
2025-03-10 21:09:09 +01:00
parent fde7d7dde2
commit aeac0a3329
2 changed files with 2 additions and 1 deletions

View File

@@ -308,7 +308,7 @@ function default_value($field) {
return ($default === null ? "" : (in_array($generated, $driver->generated)
? (JUSH == "mssql" ? " AS ($default)" . ($generated == "VIRTUAL" ? "" : " $generated") . "" : " GENERATED ALWAYS AS ($default) $generated")
: " DEFAULT " . (!preg_match('~^GENERATED ~i', $default) && (preg_match('~char|binary|text|enum|set~', $field["type"]) || preg_match('~^(?![a-z])~i', $default))
? q($default)
? (JUSH == "sql" && preg_match('~text~', $field["type"]) ? "(" . q($default) . ")" : q($default)) // MySQL requires () around default value of text column
: str_ireplace("current_timestamp()", "CURRENT_TIMESTAMP", (JUSH == "sqlite" ? "($default)" : $default))
)
));

View File

@@ -2,6 +2,7 @@ Adminer dev:
Fix gzip export (bug #896)
Fix importing multiple SQL files not terminated by semicolon
Use <datalist> for altering collations
MySQL: Allow setting default values of text column
MySQL, MariaDB: Fix default values with ' (bug #895)
MariaDB: Fix creating and altering generated columns (bug #897)