Index: package/hosting_package.install
===================================================================
RCS file: /cvs/drupal/contributions/modules/hosting/package/hosting_package.install,v
retrieving revision 1.14
diff -u -r1.14 hosting_package.install
--- package/hosting_package.install	28 Sep 2009 16:24:07 -0000	1.14
+++ package/hosting_package.install	30 Sep 2009 08:20:00 -0000
@@ -296,3 +296,24 @@
 
   return $ret;
 }
+
+// Remove duplicate packages introduced by a double validation of platform in 0.4 alpha 1
+function hosting_package_update_11() {
+  $ret = array();
+
+  $duplicate = array();
+  $result = db_query("SELECT package_id FROM {hosting_package_instance}");
+  while ($res = db_fetch_array($result)) {
+    $duplicate[] = $res['package_id'];
+  }
+  
+  $tables = array('hosting_package', 'node', 'node_revisions');
+  $duplicates = implode(', ', $duplicate);
+  foreach ($tables as $table) {
+    $query = sprintf("DELETE FROM {%s} WHERE nid NOT IN (%s)", $table, $duplicates);
+    $ret[] = update_sql($query);
+  }
+
+  return $ret;
+}
+
