You are here

function persistent_login_create_table_sql in Persistent Login 5

4 calls to persistent_login_create_table_sql()
persistent_login_install in ./persistent_login.install
persistent_login_update_1 in ./persistent_login.install
persistent_login_update_2 in ./persistent_login.install
persistent_login_update_4 in ./persistent_login.install

File

./persistent_login.install, line 14

Code

function persistent_login_create_table_sql() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = 'CREATE TABLE {persistent_login} (' . 'uid int unsigned NOT NULL, ' . 'series char(32) NOT NULL, ' . 'token char(32) NOT NULL, ' . 'expires int unsigned NOT NULL, ' . 'PRIMARY KEY (uid,series), ' . 'INDEX (expires) ' . ') /*!40100 DEFAULT CHARACTER SET utf8 */; ';
      $ret[] = 'CREATE TABLE {persistent_login_history} (' . 'uid int unsigned NOT NULL, ' . 'series char(32) NOT NULL, ' . 'token char(32) NOT NULL, ' . 'expires int unsigned NOT NULL, ' . 'at int unsigned NOT NULL, ' . 'why varchar(255) NOT NULL, ' . 'PRIMARY KEY (uid,series,token), ' . 'INDEX (at) ' . ') /*!40100 DEFAULT CHARACTER SET utf8 */;';
      break;
    case 'pgsql':
      $ret[] = 'CREATE TABLE {persistent_login} (' . 'uid int_unsigned NOT NULL, ' . 'series char(32) NOT NULL, ' . 'token char(32) NOT NULL, ' . 'expires int_unsigned NOT NULL, ' . 'PRIMARY KEY (uid,series))';
      $ret[] = 'CREATE INDEX {persistent_login}_expires_idx ON {persistent_login} (expires)';
      $ret[] = 'CREATE TABLE {persistent_login_history} (' . 'uid int_unsigned NOT NULL, ' . 'series char(32) NOT NULL, ' . 'token char(32) NOT NULL, ' . 'expires int_unsigned NOT NULL, ' . 'at int_unsigned NOT NULL, ' . 'why varchar(255) NOT NULL, ' . 'PRIMARY KEY (uid,series,token))';
      $ret[] = 'CREATE INDEX {persistent_login_history}_at_idx ON {persistent_login_history} (at)';
      break;
  }
  return $ret;
}