mirror of
https://github.com/webmin/webmin.git
synced 2025-08-16 14:51:18 +00:00
Better handle null timestamps https://github.com/webmin/webmin/issues/921#issuecomment-393014169
This commit is contained in:
@ -10,7 +10,13 @@ $access{'edonly'} && &error($text{'dbase_ecannot'});
|
||||
|
||||
# Build default clause
|
||||
if ($in{'default_def'} == 0) {
|
||||
$default = "default NULL";
|
||||
if ($in{'type'} eq 'timestamp') {
|
||||
# Default is already null
|
||||
$default = "";
|
||||
}
|
||||
else {
|
||||
$default = "default NULL";
|
||||
}
|
||||
}
|
||||
elsif ($in{'default_def'} == 2) {
|
||||
$default = "default CURRENT_TIMESTAMP";
|
||||
@ -36,7 +42,7 @@ elsif ($in{'new'}) {
|
||||
$in{'size'} = $size = &validate_size();
|
||||
$sql = sprintf "alter table %s add %s %s%s %s %s %s",
|
||||
"estr($in{'table'}), "estr($in{'field'}), $in{'type'},
|
||||
$size, $in{'null'} ? '' : 'not null',
|
||||
$size, $in{'null'} ? 'null' : 'not null',
|
||||
$default,
|
||||
$in{'ext'};
|
||||
&execute_sql_logged($in{'db'}, $sql);
|
||||
|
Reference in New Issue
Block a user