You are here

function contemplate_install in Content Templates (Contemplate) 5

Same name and namespace in other branches
  1. 6 contemplate.install \contemplate_install()
  2. 7 contemplate.install \contemplate_install()

File

./contemplate.install, line 3

Code

function contemplate_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {contemplate} (\n      type varchar(32) NOT NULL default '',\n      teaser text NOT NULL,\n      body text NOT NULL,\n      rss text NOT NULL,\n      enclosure varchar(128) NOT NULL,\n      flags int(8) unsigned NOT NULL default '7',\n      KEY type (type)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {contemplate_files} (\n      site varchar(255) NOT NULL,\n      `data` longblob NOT NULL,\n      UNIQUE KEY site (site(255))\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("UPDATE {system} SET weight = 10 WHERE name = 'contemplate'");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {contemplate} (\n      type varchar(32) NOT NULL default '',\n      teaser text NOT NULL,\n      body text NOT NULL,\n      rss text NOT NULL,\n      enclosure varchar(128) NOT NULL,\n      flags int_unsigned NOT NULL default '0',\n      PRIMARY KEY (type)\n      );");
      db_query("CREATE TABLE {contemplate_files} (\n      site varchar(255) NOT NULL,\n      data bytea NOT NULL\n      );");

      // This code is untested. Please post a fix to the issue queue if incorrect
      db_query("CREATE UNIQUE INDEX {contemplate_files}_site_idx ON {contemplate_files} (site)");
      db_query("UPDATE {system} SET weight = 10 WHERE name = 'contemplate'");
      break;
  }
  drupal_set_message(t('Database tables for ConTemplate module have been installed.'));
}