You are here

function workflow_fields_install in Workflow Fields 5

Same name and namespace in other branches
  1. 6 workflow_fields.install \workflow_fields_install()

File

./workflow_fields.install, line 3

Code

function workflow_fields_install() {
  $result = array();
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $result[] = db_query(<<<QUERY
CREATE TABLE {workflow_fields} (
  `sid` int(10) NOT NULL,
  `rid` int(10) NOT NULL,
  `name` varchar(100) NOT NULL,
  `type` varchar(100) NOT NULL,
  `visible` tinyint(4) NOT NULL,
  `editable` tinyint(4) NOT NULL,
  `visible_userref` varchar(100),
  `editable_userref` varchar(100),
  KEY `sid` (`sid`),
  KEY `rid` (`rid`)
) /*!40100 DEFAULT CHARACTER SET utf8 */;
QUERY
);
      break;
    case 'pgsql':
      drupal_set_message(t('PGSQL is currently not supported by workflow_fields.'), 'error');
      break;
  }
  if (count($result) == count(array_filter($result))) {
    drupal_set_message(t('The workflow_fields module has successfully added tables to the database.'));
  }
  else {
    drupal_set_message(t('Drupal was unable to install the database tables for the workflow_fields module.'), 'error');
  }
}