You are here

function textimage_install in Textimage 5.2

Same name and namespace in other branches
  1. 5 textimage.install \textimage_install()
  2. 6.2 textimage.install \textimage_install()
  3. 7.3 textimage.install \textimage_install()

Implementation of hook_install().

File

./textimage.install, line 48

Code

function textimage_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {textimage_preset} (\n        pid INT UNSIGNED NOT NULL PRIMARY KEY,\n        name VARCHAR(255) NOT NULL DEFAULT '',\n        description MEDIUMTEXT NOT NULL,\n        settings TEXT NOT NULL)\n        /*!40100 DEFAULT CHARACTER SET utf8 */");
      db_query("CREATE TABLE {textimage_image} (\n        pid INT UNSIGNED NOT NULL DEFAULT 0,\n        file VARCHAR(255) NOT NULL PRIMARY KEY,\n        data TEXT NOT NULL)\n        /*!40100 DEFAULT CHARACTER SET utf8 */");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {textimage_preset} (\n        pid INTEGER PRIMARY KEY CHECK (pid > 0),\n        name VARCHAR(255) NOT NULL DEFAULT '',\n        description TEXT NOT NULL,\n        settings TEXT NOT NULL DEFAULT '');");
      db_query("CREATE SEQUENCE {textimage_preset_pid_seq} INCREMENT 1 START 1;");
      db_query("CREATE TABLE {textimage_image} (\n        pid INTEGER NOT NULL DEFAULT 0,\n        file VARCHAR(255) PRIMARY KEY,\n        data TEXT NOT NULL DEFAULT '');");
      break;
  }
}