diff --git a/nodeorder.install b/nodeorder.install
index 90e8516..6c65bfb 100644
--- a/nodeorder.install
+++ b/nodeorder.install
@@ -106,3 +106,116 @@ function nodeorder_schema_alter(&$schema) {
     'description' => t('A user-defined weight for each node in its respective category.'),
   );
 }
+
+/**
+ * Implements hook_update_dependencies().
+ *
+ * Try to rescue D6 weight data in between all of taxonomy's
+ * database updates.
+ */
+function nodeorder_update_dependencies() {
+
+  // Attempt to intercept data before taxonomy messes it up.
+  // (table is renamed in taxonomy 7001, dropped in taxonomy 7004)
+  $dependencies['taxonomy'][7001] = array(
+    'nodeorder' => 7001,
+  );
+
+  // {taxonomy_index} is created in taxonomy 7004.
+  $dependencies['nodeorder'][7002] = array(
+    'taxonomy' => 7004,
+  );
+
+  return $dependencies;
+}
+
+/**
+ * Extract weight data from D6 location.
+ */
+function nodeorder_update_7001() {
+
+  if (!db_table_exists('term_node')) {
+    // Too late!
+    return t('Unable to preserve existing orderings. Update nodeorder at the same time as taxonomy module to allow this!');
+  }
+  elseif (!db_field_exists('term_node', 'weight_in_tid')) {
+    // No previous nodeorder data.
+    return;
+  }
+
+  db_create_table('nodeorder_weights_temp', array(
+      'description' => 'Temporary storage for nodeorder weights during migration',
+      'fields' => array(
+        'nid' => array(
+          'description' => 'The {node}.nid this record tracks.',
+          'type' => 'int',
+          'unsigned' => TRUE,
+          'not null' => TRUE,
+          'default' => 0,
+        ),
+        'tid' => array(
+          'description' => 'The term ID.',
+          'type' => 'int',
+          'unsigned' => TRUE,
+          'not null' => TRUE,
+          'default' => 0,
+        ),
+        'weight_in_tid' => array(
+          'type' => 'int',
+          'signed' => TRUE,
+          'not null' => TRUE,
+          'default' => 0,
+          'initial' => 0,
+          'description' => t('A user-defined weight for each node in its respective category.'),
+        ),
+      ),
+    )
+  );
+  $subquery = db_select('term_node', 't')
+    ->fields('t', array('nid', 'tid', 'weight' => 'weight_in_tid'));
+
+  $query = db_insert('nodeorder_weights_temp')
+    ->from($subquery)
+    ->execute();
+
+}
+
+/**
+ * Restore any data into its D7 home.
+ */
+function nodeorder_update_7002() {
+
+  // Set field properties.
+  $spec = array(
+    'type' => 'int',
+    'signed' => TRUE,
+    'not null' => TRUE,
+    'default' => 0,
+    'initial' => 0,
+    'description' => t('A user-defined weight for each node in its respective category.'),
+  );
+
+  // Create an index for 'weight'.
+  $keys['indexes'] = array('weight' => array('weight'));
+
+  // Add the column to the table.
+  $ret = array();
+  db_add_field('taxonomy_index', 'weight', $spec, $keys);
+  $installation_failed = FALSE;
+
+  if (db_table_exists('nodeorder_weights_temp')) {
+
+    $weights = db_query("SELECT * FROM {nodeorder_weights_temp}")->fetchAll();
+
+    foreach ($weights as $weight) {
+      db_merge('taxonomy_index')
+        ->key(array('nid' => $weight->nid, 'tid' => $weight->tid))
+        ->fields(array('weight' => $weight->weight_in_tid))
+        ->execute();
+    }
+
+    // Shouldn't be needing this anymore.
+    db_drop_table('nodeorder_weights_temp');
+
+  }
+}
