From e5d1941db7d689379f68d88f23b7e59dc7825527 Mon Sep 17 00:00:00 2001 From: gbateson Date: Fri, 28 Apr 2006 02:11:52 +0000 Subject: [PATCH] set negative values to 0, on unsigned numeric fields --- mod/hotpot/db/update_to_v2.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mod/hotpot/db/update_to_v2.php b/mod/hotpot/db/update_to_v2.php index 80523b6fbc..0bdd9c824b 100644 --- a/mod/hotpot/db/update_to_v2.php +++ b/mod/hotpot/db/update_to_v2.php @@ -75,6 +75,9 @@ function hotpot_denull_int_field($table, $field, $size, $unsigned=true) { $ok = true; $ok = $ok && execute_sql("UPDATE {$CFG->prefix}$table SET $field=0 WHERE $field IS NULL", false); + if ($unsigned) { + $ok = $ok && execute_sql("UPDATE {$CFG->prefix}$table SET $field=0 WHERE $field<0", false); + } $ok = $ok && hotpot_db_update_field_type($table, $field, $field, 'INTEGER', $size, $unsigned, 'NOT NULL', 0); return $ok; -- 2.39.5