From 2d5797dbddfe8c9fc043f7742ef303ea031b250c Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 11 Mar 2007 23:53:26 +0000 Subject: [PATCH] r1452: Adding a step to migrate custom field data (which we forgot about... woops!) --- install/upgrade11.php | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/install/upgrade11.php b/install/upgrade11.php index 4564aea..8f7e235 100644 --- a/install/upgrade11.php +++ b/install/upgrade11.php @@ -19,7 +19,7 @@ || ################################################################### \*=====================================================================*/ -define('STOP_MARK', 4); +define('STOP_MARK', 5); define('ACTIVE_SITE', 'upgrade11.php'); require_once('./global.php'); @@ -95,10 +95,44 @@ if ($bugsys->in['mark'] == 2) if ($bugsys->in['mark'] == 3) { ?> -

Database Table Additions

+

Custom Field Updates

+ +

A change was made to the storage of custom bug field data. The data is being migrated to a different database table, but no data will be lost. This may take a few minutes. Do not go onto the next step if you receive any errors here.

+query("SELECT * FROM " . TABLE_PREFIX . "bugfield"); + while ($field = $db->fetch_array($fields)) + { + // create the database field + $db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD custom$field[fieldid] MEDIUMTEXT NULL"); + + echo "Migrating custom$field[fieldid]"; + + // update all the data + $data = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill"); + while ($custom = $db->fetch_array($data)) + { + echo "."; + $db->query("UPDATE " . TABLE_PREFIX . "bug SET custom$field[fieldid] = '" . $db->escape_string($custom["field$field[fieldid]"]) . "' WHERE bugid = $custom[bugid]"); + } + echo "done
\n"; + } + + echo ".... all done
\n"; +} + +// ################################################################### + +if ($bugsys->in['mark'] == 4) +{ +?> +

Database Table Changes

A few new features require new database tables, so we're adding those now.

query("DROP TABLE " . TABLE_PREFIX . "bugvaluefill"); + echo "Dropping the old storage system for custom field data
"; $db->query(" CREATE TABLE " . TABLE_PREFIX . "passwordreset @@ -138,7 +172,7 @@ if ($bugsys->in['mark'] == 3) // ################################################################### -if ($bugsys->in['mark'] == 4) +if ($bugsys->in['mark'] == 5) { ?>

Version Number Change

-- 2.22.5