You are here

function og_update_13 in Organic groups 5

Same name and namespace in other branches
  1. 5.8 og.install \og_update_13()
  2. 5.2 og.install \og_update_13()
  3. 5.3 og.install \og_update_13()
  4. 5.7 og.install \og_update_13()

File

./og.install, line 315

Code

function og_update_13() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {og_uid_global} (\n        uid int(11) NOT NULL,\n        og_email int(11) NOT NULL DEFAULT 2,\n        PRIMARY KEY  (uid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {og_uid_global} (\n        uid int NOT NULL,\n        og_email int NOT NULL DEFAULT 2,\n        PRIMARY KEY (uid)\n      );");
      break;
  }

  // works for mysql and postgres
  $sql = 'SELECT uid FROM {users} WHERE uid > 0';
  $result = db_query($sql);
  while ($row = db_fetch_object($result)) {
    $sql = "INSERT INTO {og_uid_global} (uid, og_email) VALUES (%d, %d)";
    db_query($sql, $row->uid, OG_NOTIFICATION_SELECTIVE);
  }
  return array();
}