You are here

function login_security_update_6001 in Login Security 6

Database clean up update as for #399390 http://drupal.org/node/399390

Change current primary key to 'id' and add timestamp index

Return value

array

File

./login_security.install, line 122
Login Security installation routines

Code

function login_security_update_6001() {
  $ret = array();

  // Change current primary key
  db_drop_primary_key($ret, 'login_security_track');
  db_add_primary_key($ret, 'login_security_track', array(
    'id',
  ));

  // Drop indexes
  db_drop_index($ret, 'login_security_track', 'name');
  db_drop_index($ret, 'login_security_track', 'id');
  db_change_field($ret, 'login_security_track', 'name', 'name', array(
    'type' => 'varchar',
    'length' => 64,
    'not null' => TRUE,
    'default' => '',
    'description' => t("Clean username, after submitted using the login form."),
  ));
  db_change_field($ret, 'login_security_track', 'timestamp', 'timestamp', array(
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
    'description' => t("Timestamp of the event."),
  ));

  // Re-create indexes
  db_add_index($ret, 'login_security_track', 'name', array(
    'name',
  ));
  db_add_index($ret, 'login_security_track', 'timestamp', array(
    'timestamp',
  ));
  return $ret;
}