You are here

function cas_server_update_1 in CAS 5.3

Same name and namespace in other branches
  1. 5.4 cas_server.install \cas_server_update_1()
  2. 6.3 cas_server.install \cas_server_update_1()
  3. 6.2 cas_server.install \cas_server_update_1()

File

./cas_server.install, line 46
Cas Server Schema Install

Code

function cas_server_update_1() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $items = array();
      $items[] = update_sql("CREATE TABLE {cas_server_tickets} (\n      service varchar(256) NOT NULL default '',\n      ticket varchar(256) NOT NULL default '',\n      uid int unsigned NOT NULL,\n      timestamp int NOT NULL,\n        PRIMARY KEY  (ticket)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      return $items;
      break;
    case 'pgsql':
      $items = array();
      $items[] = update_sql("CREATE TABLE {cas_server_tickets} (\n          service varchar(256) NOT NULL default '',\n          ticket varchar(256) NOT NULL default '',\n       \t  uid integer NOT NULL CHECK (uid >= 0),\n       \t  timestamp integer NOT NULL, \n          PRIMARY KEY  (ticket)\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_server_tickets}_uid_idx\n                ON {cas_server_tickets} (uid)");
      return $items;
      break;
  }
}