|
@@ -397,12 +397,12 @@ function smf_db_change_column($table_name, $old_column, $column_info, $parameter
|
|
|
$smcFunc['db_transaction']('begin');
|
|
|
if (!$column_info['null'])
|
|
|
{
|
|
|
- // We have to set it to something if we are making it NOT NULL.
|
|
|
- $setTo = isset($column_info['default']) ? $column_info['default'] : '';
|
|
|
+ // We have to set it to something if we are making it NOT NULL. And we must comply with the current column format.
|
|
|
+ $setTo = isset($column_info['default']) ? $column_info['default'] : (strpos($old_info['type'], 'int') !== false ? 0 : '');
|
|
|
$smcFunc['db_query']('', '
|
|
|
UPDATE ' . $table_name . '
|
|
|
SET ' . $column_info['name'] . ' = \'' . $setTo . '\'
|
|
|
- WHERE ' . $column_info['name'] . ' = NULL',
|
|
|
+ WHERE ' . $column_info['name'] . ' IS NULL',
|
|
|
array(
|
|
|
'security_override' => true,
|
|
|
)
|