You are here

function oauthconnector_update_6100 in OAuth Connector 6

File

./oauthconnector.install, line 131
Install, update and uninstall functions for the OAuth Connector module.

Code

function oauthconnector_update_6100() {
  $ret = array();
  if (drupal_get_installed_schema_version('oauth_common') < 6300) {
    $ret['#abort'] = array(
      'success' => FALSE,
      'query' => 'You need to update the OAuth module prior to this module.',
    );
  }
  else {
    $oauthconnector_provider = _oauthconnector_provider_schema_1();
    db_add_field($ret, 'oauthconnector_provider', 'csid', $oauthconnector_provider['fields']['csid']);
    $ret[] = update_sql('UPDATE {oauthconnector_provider} op, {oauth_common_consumer} c SET op.csid = c.csid WHERE c.consumer_key = op.consumer_key');
    db_drop_field($ret, 'oauthconnector_provider', 'consumer_key');
    db_create_table($ret, 'oauthconnector_connections', _oauthconnector_connections_schema_1());

    //TODO: Add connections for all old connections
  }
  return $ret;
}