r4203 drop the barcode column
authorAaron Dummer <aaron@dummer.info>
Sun, 6 Feb 2011 01:53:48 +0000 (01:53 +0000)
committerAaron Dummer <aaron@dummer.info>
Sun, 6 Feb 2011 01:53:48 +0000 (01:53 +0000)
ChangeLog
README
scripts/init-sample-racks.sql
wwwroot/inc/database.php
wwwroot/inc/interface.php
wwwroot/inc/ophandlers.php
wwwroot/install.php
wwwroot/upgrade.php

index 2d50543..f52784a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
        update: cache image files thumbnails and make them JPEGs (#369, by Matt Mills)
        update: enhance rackspace click helpers (by Jeroen Benda)
        update: object type cannot be changed after the object is created
+       update: drop barcode column (by Aaron Dummer)
        bugfix: the feature of remembering last opened tab of realm page is now working
        update: UI: ports/IPs/nets highlighting enhancements
        bugfix: UI: pager in ipv4net shows appropriate page when IP is highlighted
diff --git a/README b/README
index 6416089..20791f9 100644 (file)
--- a/README
+++ b/README
@@ -105,6 +105,10 @@ Installation process does not check for this extension because the lack of it do
 base functionality. If some of ajax features are not working correctly, check if JSON extension
 is availible in your installation of PHP.
 
+The barcode attribute was removed.  The upgrade script attempts to preserve the data by moving
+it to either the 'OEM S/N 1' attribute or to a Log entry.  You should backup your database
+beforehand anyway.
+
 *** Upgrading to 0.18.x ***
 
 RackTables from its version 0.18.0 and later is not compatible with
index 3ba5baf..4531b29 100644 (file)
@@ -1,64 +1,64 @@
 set names 'utf8';
 
-INSERT INTO `RackObject` (id, name, label, barcode, objtype_id, asset_no, has_problems, comment) VALUES 
-(905,'london router','bbrtr1',NULL,7,'net247','no',''),
-(906,'londonswitch1','',NULL,8,NULL,'no',''),
-(907,'New-York router 1','bbrtr2a',NULL,7,'net55','no',''),
-(908,'moscow router','bbrtr3',NULL,7,NULL,'no',NULL),
-(909,'tokyo router','bbrtr4',NULL,7,NULL,'no',NULL),
-(910,'London server 1','lserver01',NULL,4,'srv500','no',''),
-(911,'London server 2','lserver02',NULL,4,'srv501','no',''),
-(912,'London server 3','lserver03',NULL,4,'srv502','no',''),
-(913,'London server 4','lserver04',NULL,4,'srv503','yes','this one needs replacement'),
-(914,'London server 5','lserver05',NULL,4,'srv504','no',''),
-(915,'london LB','llb',NULL,8,'net1000','no',''),
-(916,'shared storage','',NULL,5,NULL,'no',''),
-(917,'london-NAS','',NULL,7,'net1001','no',''),
-(918,'London server 6','lserver06',NULL,4,'srv505','no',NULL),
-(919,'London server 7','lserver07',NULL,4,'srv506','no',NULL),
-(920,'backup library','lbackup',NULL,6,'misc200','no',NULL),
-(921,'lserver06 array','lserver06 array',NULL,5,NULL,'no',NULL),
-(922,'lserver07 array','lserver07 array',NULL,5,NULL,'no',NULL),
-(923,'Tokyo server 1','tserver01',NULL,4,'srv654','no',NULL),
-(924,'Tokyo server 2','tserver02',NULL,4,'srv848','no',NULL),
-(925,'Tokyo server 3','tserver03',NULL,4,'srv139','no',NULL),
-(926,'Tokyo switch','tswitch',NULL,8,'net385','no',NULL),
-(927,'New-York router 2','bbrtr2b',NULL,7,'net498','no',NULL),
-(928,'New-York IPVS LB A','nylba',NULL,4,'net554','no',NULL),
-(929,'New-York IPVS LB B','nylbb',NULL,4,'net555','no',NULL),
-(930,'New-York server switch A','nyswitcha',NULL,8,'net084','no',NULL),
-(931,'New-York server switch B','nyswitchb',NULL,8,'net486','no',NULL),
-(932,'New-York server 1A','nysrv1a',NULL,4,'srv287','no',NULL),
-(933,'New-York server 1B','nysrv1b',NULL,4,'srv288','no',NULL),
-(934,'New-York server 2A','nysrv2a',NULL,4,NULL,'no',NULL),
-(935,'New-York server 2B','nysrv2b',NULL,4,NULL,'no',NULL),
-(936,'New-York server 3A','nysrv3a',NULL,4,NULL,'no',NULL),
-(937,'New-York server 3B','nysrv3b',NULL,4,NULL,'no',NULL),
-(938,'New-York server 4A','nysrv4a',NULL,4,NULL,'no',NULL),
-(939,'New-York server 4B','nysrv4b',NULL,4,NULL,'no',NULL),
-(940,'New-York server 5A','nysrv5a',NULL,4,NULL,'no',NULL),
-(941,'New-York server 5B','nysrv5b',NULL,4,NULL,'no',NULL),
-(942,'wing A UPS','',NULL,12,NULL,'no',NULL),
-(943,'wing B UPS','',NULL,12,NULL,'no',NULL),
-(944,'network UPS','',NULL,12,NULL,'no',NULL),
-(945,NULL,'',NULL,9,NULL,'no',NULL),
-(946,NULL,'',NULL,9,NULL,'no',NULL),
-(947,NULL,'',NULL,2,NULL,'no',NULL),
-(948,NULL,'',NULL,2,NULL,'no',NULL),
-(949,NULL,'',NULL,2,NULL,'no',NULL),
-(950,NULL,'',NULL,2,NULL,'no',NULL),
-(951,NULL,'',NULL,2,NULL,'no',NULL),
-(952,NULL,'',NULL,2,NULL,'no',NULL),
-(953,NULL,'',NULL,2,NULL,'no',NULL),
-(954,NULL,'',NULL,2,NULL,'no',NULL),
-(955,NULL,'',NULL,2,NULL,'no',NULL),
-(956,'mps1','','200161',4,NULL,'no',NULL),
-(957,'mps2','','200283',4,NULL,'no',NULL),
-(958,'mps3','','200881',4,NULL,'no',NULL),
-(959,'mps4','','200458',4,NULL,'no',NULL),
-(960,'mps5','','200112',4,NULL,'no',NULL),
-(961,'mskswitch','',NULL,8,'sw0001','no',NULL),
-(962,'moscow kvm switch','','300221',445,'sw0002','no',NULL);
+INSERT INTO `RackObject` (id, name, label, objtype_id, asset_no, has_problems, comment) VALUES 
+(905,'london router','bbrtr1',7,'net247','no',''),
+(906,'londonswitch1','',8,NULL,'no',''),
+(907,'New-York router 1','bbrtr2a',7,'net55','no',''),
+(908,'moscow router','bbrtr3',7,NULL,'no',NULL),
+(909,'tokyo router','bbrtr4',7,NULL,'no',NULL),
+(910,'London server 1','lserver01',4,'srv500','no',''),
+(911,'London server 2','lserver02',4,'srv501','no',''),
+(912,'London server 3','lserver03',4,'srv502','no',''),
+(913,'London server 4','lserver04',4,'srv503','yes','this one needs replacement'),
+(914,'London server 5','lserver05',4,'srv504','no',''),
+(915,'london LB','llb',8,'net1000','no',''),
+(916,'shared storage','',5,NULL,'no',''),
+(917,'london-NAS','',7,'net1001','no',''),
+(918,'London server 6','lserver06',4,'srv505','no',NULL),
+(919,'London server 7','lserver07',4,'srv506','no',NULL),
+(920,'backup library','lbackup',6,'misc200','no',NULL),
+(921,'lserver06 array','lserver06 array',5,NULL,'no',NULL),
+(922,'lserver07 array','lserver07 array',5,NULL,'no',NULL),
+(923,'Tokyo server 1','tserver01',4,'srv654','no',NULL),
+(924,'Tokyo server 2','tserver02',4,'srv848','no',NULL),
+(925,'Tokyo server 3','tserver03',4,'srv139','no',NULL),
+(926,'Tokyo switch','tswitch',8,'net385','no',NULL),
+(927,'New-York router 2','bbrtr2b',7,'net498','no',NULL),
+(928,'New-York IPVS LB A','nylba',4,'net554','no',NULL),
+(929,'New-York IPVS LB B','nylbb',4,'net555','no',NULL),
+(930,'New-York server switch A','nyswitcha',8,'net084','no',NULL),
+(931,'New-York server switch B','nyswitchb',8,'net486','no',NULL),
+(932,'New-York server 1A','nysrv1a',4,'srv287','no',NULL),
+(933,'New-York server 1B','nysrv1b',4,'srv288','no',NULL),
+(934,'New-York server 2A','nysrv2a',4,NULL,'no',NULL),
+(935,'New-York server 2B','nysrv2b',4,NULL,'no',NULL),
+(936,'New-York server 3A','nysrv3a',4,NULL,'no',NULL),
+(937,'New-York server 3B','nysrv3b',4,NULL,'no',NULL),
+(938,'New-York server 4A','nysrv4a',4,NULL,'no',NULL),
+(939,'New-York server 4B','nysrv4b',4,NULL,'no',NULL),
+(940,'New-York server 5A','nysrv5a',4,NULL,'no',NULL),
+(941,'New-York server 5B','nysrv5b',4,NULL,'no',NULL),
+(942,'wing A UPS','',12,NULL,'no',NULL),
+(943,'wing B UPS','',12,NULL,'no',NULL),
+(944,'network UPS','',12,NULL,'no',NULL),
+(945,NULL,'',9,NULL,'no',NULL),
+(946,NULL,'',9,NULL,'no',NULL),
+(947,NULL,'',2,NULL,'no',NULL),
+(948,NULL,'',2,NULL,'no',NULL),
+(949,NULL,'',2,NULL,'no',NULL),
+(950,NULL,'',2,NULL,'no',NULL),
+(951,NULL,'',2,NULL,'no',NULL),
+(952,NULL,'',2,NULL,'no',NULL),
+(953,NULL,'',2,NULL,'no',NULL),
+(954,NULL,'',2,NULL,'no',NULL),
+(955,NULL,'',2,NULL,'no',NULL),
+(956,'mps1','',4,NULL,'no',NULL),
+(957,'mps2','',4,NULL,'no',NULL),
+(958,'mps3','',4,NULL,'no',NULL),
+(959,'mps4','',4,NULL,'no',NULL),
+(960,'mps5','',4,NULL,'no',NULL),
+(961,'mskswitch','',8,'sw0001','no',NULL),
+(962,'moscow kvm switch','',445,'sw0002','no',NULL);
 
 INSERT INTO `AttributeValue` VALUES (905,2,NULL,269,NULL);
 INSERT INTO `AttributeValue` VALUES (906,2,NULL,165,NULL);
@@ -705,10 +705,10 @@ INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (3,NULL,'testing');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (4,NULL,'production');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (5,1,'far east');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (6,2,'far west');
-INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (7,1,'Ð\9cоÑ\81ква');
+INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (7,1,'Ã\90Å\93Ã\90¾Ã\91�Ã\90ºÃ\90²Ã\90°');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (8,2,'London');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (9,6,'New-York');
-INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (10,5,'æ\9d±äº¬');
+INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (10,5,'�京');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (11,17,'WAN link');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (12,NULL,'racks');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (13,12,'tall racks');
@@ -716,9 +716,9 @@ INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (14,12,'low racks');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (15,NULL,'load balancer');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (18,17,'small network');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (19,17,'medium network');
-INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (20,5,'å\8c\97京');
-INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (21,5,'ì\84\9cì\9a¸');
-INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (22,5,'Ð\92ладивоÑ\81Ñ\82ок');
+INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (20,5,'Ã¥Å\92â\80\94京');
+INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (21,5,'ìâ\80\9eÅ\93울');
+INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (22,5,'Ã\90â\80\99Ã\90»Ã\90°Ã\90´Ã\90¸Ã\90²Ã\90¾Ã\91�Ã\91â\80\9aÃ\90¾Ã\90º');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (23,NULL,'XKCD');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (24,23,'romance');
 INSERT INTO `TagTree` (`id`, `parent_id`, `tag`) VALUES (25,23,'sarcasm');
index 3e3a69c..aa76b29 100644 (file)
@@ -15,7 +15,6 @@ $SQLSchema = array
                        'id' => 'id',
                        'name' => 'name',
                        'label' => 'label',
-                       'barcode' => 'barcode',
                        'asset_no' => 'asset_no',
                        'objtype_id' => 'objtype_id',
                        'rack_id' => '(select rack_id from RackSpace where object_id = id order by rack_id asc limit 1)',
@@ -597,7 +596,7 @@ function commitAddRack ($name, $height, $row_id, $comment, $taglist)
        recordHistory ('Rack', $last_insert_id);
 }
 
-function commitAddObject ($new_name, $new_label, $new_barcode, $new_type_id, $new_asset_no, $taglist = array())
+function commitAddObject ($new_name, $new_label, $new_type_id, $new_asset_no, $taglist = array())
 {
        // Maintain UNIQUE INDEX for common names and asset tags by
        // filtering out empty strings (not NULLs).
@@ -608,7 +607,6 @@ function commitAddObject ($new_name, $new_label, $new_barcode, $new_type_id, $ne
                (
                        'name' => !strlen ($new_name) ? NULL : $new_name,
                        'label' => $new_label,
-                       'barcode' => !strlen ($new_barcode) ? NULL : $new_barcode,
                        'objtype_id' => $new_type_id,
                        'asset_no' => !strlen ($new_asset_no) ? NULL : $new_asset_no,
                )
@@ -624,7 +622,7 @@ function commitAddObject ($new_name, $new_label, $new_barcode, $new_type_id, $ne
        return $last_insert_id;
 }
 
-function commitUpdateObject ($object_id, $new_name, $new_label, $new_barcode, $new_has_problems, $new_asset_no, $new_comment)
+function commitUpdateObject ($object_id, $new_name, $new_label, $new_has_problems, $new_asset_no, $new_comment)
 {
        usePreparedUpdateBlade
        (
@@ -633,7 +631,6 @@ function commitUpdateObject ($object_id, $new_name, $new_label, $new_barcode, $n
                (
                        'name' => !mb_strlen ($new_name) ? NULL : $new_name,
                        'label' => !mb_strlen ($new_label) ? NULL : $new_label,
-                       'barcode' => !mb_strlen ($new_barcode) ? NULL : $new_barcode,
                        'has_problems' => $new_has_problems,
                        'asset_no' => !mb_strlen ($new_asset_no) ? NULL : $new_asset_no,
                        'comment' => $new_comment,
@@ -1951,7 +1948,7 @@ function getObjectSearchResults ($what)
 function getObjectAttrsSearchResults ($what)
 {
        $ret = array();
-       foreach (array ('name', 'label', 'asset_no', 'barcode') as $column)
+       foreach (array ('name', 'label', 'asset_no') as $column)
        {
                $tmp = getSearchResultByField
                (
index 4213250..391cf7b 100644 (file)
@@ -681,13 +681,11 @@ function renderEditObjectForm ($object_id)
        {
                echo "<input type=hidden name=object_label value=''>\n";
                echo "<input type=hidden name=object_asset_no value=''>\n";
-               echo "<input type=hidden name=object_barcode value=''>\n";
        }
        else
        {
                echo "<tr><td>&nbsp;</td><th class=tdright>Visible label:</th><td class=tdleft><input type=text name=object_label value='${object['label']}'></td></tr>\n";
                echo "<tr><td>&nbsp;</td><th class=tdright>Asset tag:</th><td class=tdleft><input type=text name=object_asset_no value='${object['asset_no']}'></td></tr>\n";
-               echo "<tr><td>&nbsp;</td><th class=tdright>Barcode:</th><td class=tdleft><input type=text name=object_barcode value='${object['barcode']}'></td></tr>\n";
        }
        // parent selection
        if (rackObjectTypeMayHaveParent ($object['objtype_id']))
@@ -996,8 +994,6 @@ function renderRackObject ($object_id)
                echo "<tr><td colspan=2 class=msg_error>Asset tag is missing.</td></tr>\n";
        if (strlen ($info['label']))
                echo "<tr><th width='50%' class=tdright>Visible label:</th><td class=tdleft>${info['label']}</td></tr>\n";
-       if (strlen ($info['barcode']))
-               echo "<tr><th width='50%' class=tdright>Barcode:</th><td class=tdleft>${info['barcode']}</td></tr>\n";
        if ($parents = getEntityRelatives ('parents', 'object', $object_id))
        {
                foreach ($parents as $parent)
@@ -2147,7 +2143,7 @@ function renderDepot ()
                {
                        startPortlet ('Objects (' . count ($objects) . ')');
                        echo '<br><br><table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>';
-                       echo '<tr><th>Common name</th><th>Visible label</th><th>Asset tag</th><th>Barcode</th><th>Row/Rack</th></tr>';
+                       echo '<tr><th>Common name</th><th>Visible label</th><th>Asset tag</th><th>Row/Rack</th></tr>';
                        $order = 'odd';
                        foreach ($objects as $obj)
                        {
@@ -2160,7 +2156,6 @@ function renderDepot ()
                                        echo '<br><small>' . serializeTags ($obj['etags'], makeHref(array('page'=>$pageno, 'tab'=>'default')) . '&') . '</small>';
                                echo "</td><td class='${secondclass}'>${obj['label']}</td>";
                                echo "<td class='${secondclass}'>${obj['asset_no']}</td>";
-                               echo "<td class='${secondclass}'>${obj['barcode']}</td>";
                                if ($obj['rack_id'])
                                        echo "<td class='${secondclass}'><a href='".makeHref(array('page'=>'row', 'row_id'=>$obj['row_id']))."'>${obj['Row_name']}</a>/<a href='".makeHref(array('page'=>'rack', 'rack_id'=>$obj['rack_id']))."'>${obj['Rack_name']}</a></td>";
                                else
@@ -2223,10 +2218,10 @@ function renderHistory ($object_type, $object_id)
                        break;
                case 'object':
                        $query =
-                               "select ctime, user_name, RackObjectHistory.name as name, label, barcode, asset_no, has_problems, dict_value, comment " .
+                               "select ctime, user_name, RackObjectHistory.name as name, label, asset_no, has_problems, dict_value, comment " .
                                "from RackObjectHistory inner join Dictionary on objtype_id = dict_key join Chapter on Dictionary.chapter_id = Chapter.id " .
                                "where Chapter.name = 'RackObjectType' and RackObjectHistory.id=? order by ctime";
-                       $header = '<tr><th>change time</th><th>author</th><th>common name</th><th>visible label</th><th>barcode</th><th>asset no</th><th>has problems?</th><th>object type</th><th>comment</th></tr>';
+                       $header = '<tr><th>change time</th><th>author</th><th>common name</th><th>visible label</th><th>asset no</th><th>has problems?</th><th>object type</th><th>comment</th></tr>';
                        $extra = 8;
                        break;
                default:
@@ -3663,7 +3658,6 @@ function renderAddMultipleObjectsForm ()
                echo "<td><input type=text size=30 name=${i}_object_name tabindex=${tabindex}></td>";
                echo "<td><input type=text size=30 name=${i}_object_label tabindex=${tabindex}></td>";
                echo "<td><input type=text size=20 name=${i}_object_asset_no tabindex=${tabindex}></td>";
-               echo "<td><input type=text size=10 name=${i}_object_barcode tabindex=${tabindex}></td>";
                if ($i == 0)
                {
                        echo "<td valign=top rowspan=${max}>";
index 671fe94..1f8e038 100644 (file)
@@ -1106,7 +1106,6 @@ function updateObject ()
        assertUIntArg ('num_attrs', TRUE);
        assertStringArg ('object_name', TRUE);
        assertStringArg ('object_label', TRUE);
-       assertStringArg ('object_barcode', TRUE);
        assertStringArg ('object_asset_no', TRUE);
        if (isset ($_REQUEST['object_has_problems']) and $_REQUEST['object_has_problems'] == 'on')
                $has_problems = 'yes';
@@ -1117,7 +1116,6 @@ function updateObject ()
                $_REQUEST['object_id'],
                $_REQUEST['object_name'],
                $_REQUEST['object_label'],
-               $_REQUEST['object_barcode'],
                $has_problems,
                $_REQUEST['object_asset_no'],
                $_REQUEST['object_comment']
@@ -1189,7 +1187,6 @@ function addMultipleObjects()
                if (isset ($_REQUEST['virtual_objects']))
                {
                        $_REQUEST["${i}_object_label"] = '';
-                       $_REQUEST["${i}_object_barcode"] = '';
                        $_REQUEST["${i}_object_asset_no"] = '';
                }
 
@@ -1197,7 +1194,6 @@ function addMultipleObjects()
                assertStringArg ("${i}_object_name", TRUE);
                assertStringArg ("${i}_object_label", TRUE);
                assertStringArg ("${i}_object_asset_no", TRUE);
-               assertStringArg ("${i}_object_barcode", TRUE);
                $name = $_REQUEST["${i}_object_name"];
 
                // It's better to skip silently, than to print a notice.
@@ -1207,7 +1203,6 @@ function addMultipleObjects()
                (
                        $name,
                        $_REQUEST["${i}_object_label"],
-                       $_REQUEST["${i}_object_barcode"],
                        $_REQUEST["${i}_object_type_id"],
                        $_REQUEST["${i}_object_asset_no"],
                        $taglist
index e40aa1b..1365ea5 100644 (file)
@@ -726,22 +726,19 @@ CREATE TABLE `RackObject` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `name` char(255) default NULL,
   `label` char(255) default NULL,
-  `barcode` char(16) default NULL,
   `objtype_id` int(10) unsigned NOT NULL default '1',
   `asset_no` char(64) default NULL,
   `has_problems` enum('yes','no') NOT NULL default 'no',
   `comment` text,
   PRIMARY KEY  (`id`),
   UNIQUE KEY `RackObject_asset_no` (`asset_no`),
-  UNIQUE KEY `name` (`name`),
-  UNIQUE KEY `barcode` (`barcode`)
+  UNIQUE KEY `name` (`name`)
 ) ENGINE=InnoDB;
 
 CREATE TABLE `RackObjectHistory` (
   `id` int(10) unsigned default NULL,
   `name` char(255) default NULL,
   `label` char(255) default NULL,
-  `barcode` char(16) default NULL,
   `objtype_id` int(10) unsigned default NULL,
   `asset_no` char(64) default NULL,
   `has_problems` enum('yes','no') NOT NULL default 'no',
index 3f337fa..ecb5255 100644 (file)
@@ -902,8 +902,34 @@ CREATE TABLE `EntityLink` (
                        $query[] = "UPDATE Config SET varvalue = CONCAT(varvalue, ' or {\$typeid_2} or {\$typeid_6} or {\$typeid_1502} or {\$typeid_1503} or {\$typeid_1504} or {\$typeid_1507}') WHERE varname = 'IPV4OBJ_LISTSRC'";
                        $query[] = "UPDATE Config SET varvalue = '8' WHERE varname = 'MASSCOUNT'";
                        $query[] = "UPDATE RackObject SET label = NULL WHERE label = ''";
-                       $query[] = "UPDATE Config SET varvalue = '0.19.0' WHERE varname = 'DB_VERSION'";
+                       // Move barcode data so the column can be dropped
+                       $result = $dbxlink->query ('SELECT id, objtype_id, barcode FROM RackObject WHERE barcode IS NOT NULL');
+                       while ($row = $result->fetch (PDO::FETCH_ASSOC))
+                       {
+                               // Determine if this object type has the 'OEM S/N 1' attribute associated with it, and if it's set
+                               $sn_query  = "SELECT (SELECT COUNT(*) FROM AttributeMap WHERE objtype_id=${row['objtype_id']} AND attr_id=1) AS AM_count, ";
+                               $sn_query .= "(SELECT COUNT(*) FROM AttributeValue WHERE object_id=${row['id']} AND attr_id=1) AS AV_count";
+                               $sn_result = $dbxlink->query ($sn_query);
+                               $sn_row = $sn_result->fetch (PDO::FETCH_ASSOC);
+                               if ($sn_row['AM_count'] == 1 && $sn_row['AV_count'] == 0)
+                               {
+                                       // 'OEM S/N 1' attribute is mapped to this object type, but it is not set.  Good!
+                                       // Copy the barcode value to the attribute.
+                                       $query[] = "INSERT INTO AttributeValue (`object_id`, `attr_id`, `string_value`) VALUES (${row['id']}, 1, '${row['barcode']}')";
+                               }
+                               else
+                               {
+                                       // Some other set of circumstances.  Not as good!
+                                       // Copy the barcode value to a new ObjectLog record.
+                                       $query[] = "INSERT INTO ObjectLog (`object_id`, `user`, `date`, `content`) VALUES (${row['id']}, '${_SERVER['PHP_AUTH_USER']}', NOW(), 'Upgrade to 0.19 dropped the barcode column. Value was: ${row['barcode']}')";
+                               }
+                               unset ($sn_query, $sn_result, $sn_row);
+                       }
+                       unset ($result);
+                       $query[] = 'ALTER TABLE RackObject DROP COLUMN `barcode`';
+                       $query[] = 'ALTER TABLE RackObjectHistory DROP COLUMN `barcode`';
                        $query[] = 'ALTER TABLE `VLANSwitchTemplate` DROP COLUMN `max_local_vlans`';
+                       $query[] = "UPDATE Config SET varvalue = '0.19.0' WHERE varname = 'DB_VERSION'";
                        break;
                default:
                        showError ("executeUpgradeBatch () failed, because batch '${batchid}' isn't defined");