You are here

function headerimage_install in Header image 5

Same name and namespace in other branches
  1. 6 headerimage.install \headerimage_install()

File

./headerimage.install, line 3

Code

function headerimage_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query(" CREATE TABLE {headerimage} (\n        nid int unsigned NOT NULL default '0',\n        block varchar(32) NOT NULL default '0',\n        weight tinyint DEFAULT '0' NOT NULL,\n        conditions text NOT NULL,\n        KEY nid (nid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query(" CREATE TABLE {headerimage_block} (\n        delta int unsigned NOT NULL AUTO_INCREMENT,\n        title varchar(64) DEFAULT '' NOT NULL,\n        KEY nid (delta)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {headerimage} (\n        nid int_unsigned NOT NULL default '0',\n        block varchar(32) NOT NULL default '0',\n        weight smallint DEFAULT '0' NOT NULL,\n        conditions text NOT NULL\n      ) ");
      db_query("CREATE INDEX {headerimage}_nid_idx ON {headerimage} (nid)");
      db_query("CREATE TABLE {headerimage_block} (\n        delta SERIAL,\n        title varchar(64) DEFAULT '' NOT NULL\n      ) ");
      break;
  }
  drupal_set_message(t('Header Image module installed successfully.'));
}