You are here

function fb_user_update_6007 in Drupal for Facebook 6.3

Install fb_user table and move entries in authmap table to fb_user.

File

./fb_user.install, line 162
Install file for fb_user.module.

Code

function fb_user_update_6007() {
  $table_schema = fb_user_schema();
  $ret = '';
  db_create_table($ret, 'fb_user', $table_schema['fb_user']);

  // Move everything across
  $sql = "INSERT INTO {fb_user} SELECT uid, authname FROM {authmap} WHERE module = 'fb_user'";
  $ret[] = update_sql($sql);

  // Delete authmap table entries, careful to only delete after above insert.
  $sql = "DELETE FROM {authmap} WHERE module = 'fb_user' AND uid IN (SELECT uid FROM {fb_user})";
  $ret[] = update_sql($sql);
  return $ret;
}