--- statuses-upgrade-path-1501978-23.patch	Sun Jul 29 00:45:28 2012
+++ statuses-upgrade-path-1501978-27.patch	Mon Jul 30 11:48:15 2012
@@ -304,7 +304,7 @@
   */
  function fbss_userpoints_uninstall() {
 diff --git a/submodules/statuses_tags/statuses_tags.install b/submodules/statuses_tags/statuses_tags.install
-index be0c4d2..4007084 100644
+index be0c4d2..959ba95 100644
 --- a/submodules/statuses_tags/statuses_tags.install
 +++ b/submodules/statuses_tags/statuses_tags.install
 @@ -2,8 +2,7 @@
@@ -328,7 +328,7 @@
        variable_set('statuses_tags_vid', $already_exists->vid);
        drupal_set_message(st('The vocabulary "@name" has been configured for use with the Statuses Tags module.', array('@name' => $already_exists->name)));
        return;
-@@ -74,7 +73,7 @@ function statuses_tags_install() {
+@@ -74,13 +73,23 @@ function statuses_tags_install() {
      );
      taxonomy_vocabulary_save($vocabulary);
      $vid = isset($vocabulary->vid) ? $vocabulary->vid :
@@ -337,7 +337,23 @@
      variable_set('statuses_tags_vid', $vid);
      drupal_set_message(st('The vocabulary "Hashtags" has been created and configured for use with the Statuses Tags module.'));
    }
-@@ -113,3 +112,38 @@ function statuses_tags_uninstall() {
+   else {
+     drupal_set_message(st('Statuses Tags only allows using #hashtags when the Taxonomy module is installed.'));
+   }
++  /**
++   * When upgrading from facebook_status a normal update hook won't register
++   * because we are installing the "statuses" module for the first time. To get
++   * around this, we force the update hook to run during installation.
++   */
++  $sandbox = array();
++  $result = _statuses_tags_update_7100($sandbox);
++  if ($result) {
++    drupal_set_message($result);
++  }
+ }
+ 
+ /**
+@@ -113,3 +122,48 @@ function statuses_tags_uninstall() {
    // FBSST is ever installed again.
    //variable_del('statuses_tags_alt_pattern');
  }
@@ -345,10 +361,20 @@
 +/**
 + * Implements hook_update_N().
 + */
-+function statuses_tags_update_7100(&$sandbox) {
++function _statuses_tags_update_7100(&$sandbox) {
 +  if (db_table_exists('facebook_status_tags')) {
-+    // Rename the database table.
-+    db_rename_table('facebook_status_tags', 'statuses_tags');
++    // Transfer data.
++    // This might take a long time, but it should be manageable.
++    // See https://drupal.org/node/1501978 for discussion of alternatives.
++    db_query("
++      INSERT INTO {statuses_tags} (sid, rid, type, name)
++      SELECT f.sid, f.rid, f.type, f.name
++      FROM {facebook_status_tags} f
++      ORDER BY f.sid ASC
++    ");
++
++    // Delete old tables.
++    drupal_uninstall_schema('facebook_status_tags');
 +
 +    // Update the vocabulary.
 +    if (variable_get('facebook_status_tags_vid', -1) != -1) {
