You are here

function faq_update_1 in Frequently Asked Questions 5.2

Same name and namespace in other branches
  1. 5 faq.install \faq_update_1()
  2. 6 faq.install \faq_update_1()
  3. 7.2 faq.install \faq_update_1()
  4. 7 faq.install \faq_update_1()

Create the new 'faq_weights' table in order to upgrade from older installations.

Return value

An array containing the structure of the SQL schema.

File

./faq.install, line 115
FAQ module install file.

Code

function faq_update_1() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("CREATE TABLE IF NOT EXISTS {faq_weights} (\n        tid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n        nid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n        weight TINYINT(4) NOT NULL DEFAULT '0',\n        PRIMARY KEY (tid, nid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      $ret[] = update_sql('CREATE TABLE {faq_weights} (
        tid integer NOT NULL DEFAULT 0,
        nid integer NOT NULL DEFAULT 0,
        weight smallint NOT NULL DEFAULT 0,
        PRIMARY KEY (tid, nid)
      );');
      break;
  }
  return $ret;
}