You are here

headerimage.install in Header image 5

Same filename and directory in other branches
  1. 6 headerimage.install
  2. 7 headerimage.install

File

headerimage.install
View source
<?php

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.'));
}
function headerimage_uninstall() {
  db_query('DROP TABLE {headerimage}');
  db_query('DROP TABLE {headerimage_block}');
  db_query("DELETE FROM {variable} WHERE name LIKE 'headerimage_%%'");
}

/**
 * Remove default from field conditions.
 */
function headerimage_update_5001() {
  $ret = array();
  $ret[] = update_sql("ALTER TABLE {headerimage} CHANGE conditions conditions text NOT NULL");
  return $ret;
}

Functions

Namesort descending Description
headerimage_install
headerimage_uninstall
headerimage_update_5001 Remove default from field conditions.