You are here

function cas_update_1 in CAS 5.3

Same name and namespace in other branches
  1. 5.4 cas.install \cas_update_1()
  2. 6.3 cas.install \cas_update_1()
  3. 6.2 cas.install \cas_update_1()
  4. 7 cas.install \cas_update_1()

File

./cas.install, line 42
CAS Install

Code

function cas_update_1() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $items = array();
      $items[] = update_sql("CREATE TABLE {cas_login_data} (\n      cas_session_id varchar(256) NOT NULL default '',\n      uid int unsigned NOT NULL,\n        PRIMARY KEY  (cas_session_id)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      return $items;
      break;
    case 'pgsql':
      $items = array();
      $items[] = update_sql("CREATE TABLE {cas_login_data} (\n      \t  cas_session_id varchar(256) NOT NULL default '',\n      \t  uid integer NOT NULL CHECK (uid >= 0),\n          PRIMARY KEY  (cas_session_id)\n        )");

      // Pgsql requires keys and indexes to be defined separately.
      // It's important to name the index as {tablename}_fieldname_idx
      // (the trailing _idx!) so update scripts can be written easily
      $items[] = update_sql("CREATE INDEX {cas_login_data}_uid_idx\n                ON {cas_login_data} (uid)");
      return $items;
      break;
  }
}