You are here

function messaging_install in Messaging 5

Same name and namespace in other branches
  1. 6.4 messaging.install \messaging_install()
  2. 6 messaging.install \messaging_install()
  3. 6.2 messaging.install \messaging_install()
  4. 6.3 messaging.install \messaging_install()

Implemenation of hook_install().

File

./messaging.install, line 6

Code

function messaging_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {messaging_message_parts} (\n          type varchar(100) NOT NULL,\n          method varchar(50) NOT NULL,\n          msgkey varchar(100) NOT NULL,\n          module varchar(255) NOT NULL,\n          message TEXT,\n          INDEX (type),\n          INDEX (method),\n          INDEX (msgkey)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      db_query("CREATE TABLE {messaging_store} (\n          mqid int unsigned NOT NULL auto_increment,\n          uid int unsigned NOT NULL,\n          sender int unsigned NOT NULL default '0',\n          method varchar(255) default NULL,\n          destination varchar(255) default NULL,\n          subject varchar(255) default NULL,\n          body longtext NOT NULL,\n          params longtext NOT NULL,\n          created int NOT NULL default '0',\n          sent int NOT NULL default '0',\n          cron tinyint NOT NULL default '0',\n          queue tinyint NOT NULL default '0',\n          log tinyint NOT NULL default '0',\n          PRIMARY KEY  (mqid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {messaging_message_parts} (\n          type varchar(100) NOT NULL,\n          method varchar(50) NOT NULL,\n          msgkey varchar(100) NOT NULL,\n          module varchar(255) NOT NULL,\n          message TEXT\n        )");
      db_query("CREATE INDEX {messaging_message_parts}_type_idx ON {messaging_message_parts} (type)");
      db_query("CREATE INDEX {messaging_message_parts}_method_idx ON {messaging_message_parts} (method)");
      db_query("CREATE INDEX {messaging_message_parts}_msgkey_idx ON {messaging_message_parts} (msgkey)");
      db_query("CREATE TABLE {messaging_store} (\n          mqid serial,\n          uid int_unsigned NOT NULL,\n          sender int_unsigned NOT NULL default '0',\n          method varchar(255) default NULL,\n          destination varchar(255) default NULL,\n          subject varchar(255) default NULL,\n          body text NOT NULL,\n          params text NOT NULL,\n          created int NOT NULL default '0',\n          sent int NOT NULL default '0',\n          cron smallint NOT NULL default '0',\n          queue smallint NOT NULL default '0',\n          log smallint NOT NULL default '0',\n          PRIMARY KEY  (mqid)\n        )");
      break;
  }

  // Create default input filter
  _messaging_install_create_filter();
}