You are here

function conditional_fields_install in Conditional Fields 5

Same name and namespace in other branches
  1. 6.2 conditional_fields.install \conditional_fields_install()
  2. 6 conditional_fields.install \conditional_fields_install()

Implementation of hook_install().

File

./conditional_fields.install, line 6

Code

function conditional_fields_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {conditional_fields} (\n        control_field_name varchar(32) NOT NULL default '',\n        field_name varchar(32) NOT NULL default '',\n        type varchar(127) NOT NULL default '',\n        trigger_values mediumtext NOT NULL\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':

      // Untested
      db_query("CREATE TABLE {conditional_fields} (\n        control_field_name varchar(32) NOT NULL default '',\n        field_name varchar(32) NOT NULL default '',\n        type varchar(127) NOT NULL default '',\n        trigger_values text NOT NULL\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
  }

  // Increase module weight to 10, over fieldgroup.module which has 9.
  db_query("UPDATE {system} SET weight = 10 WHERE name = 'conditional_fields'");
}