]>
src.bluestatic.org Git - bugdar.git/blob - docs/migrate_custom_fields.php
3 // migrates custom field data from bugvaluefill to bug
7 require_once('global.php');
10 $fields = $db->query("SELECT * FROM " . TABLE_PREFIX
. "bugfield");
11 foreach ($fields as $field)
13 // create the database field
14 $db->query("ALTER TABLE " . TABLE_PREFIX
. "bug ADD custom$field[fieldid] MEDIUMTEXT NULL");
16 // update all the data
17 $data = $db->query("SELECT * FROM " . TABLE_PREFIX
. "bugvaluefill");
18 foreach ($data as $custom)
20 $db->query("UPDATE " . TABLE_PREFIX
. "bug SET custom$field[fieldid] = '" . $db->escape_string($custom["field$field[fieldid]"]) . "' WHERE bugid = $custom[bugid]");