You are here

workflow_access.install in Workflow 5

Same filename and directory in other branches
  1. 5.2 workflow_access.install

File

workflow_access.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function workflow_access_install() {
  $result = array();
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $result[] = db_query(<<<QUERY
CREATE TABLE {workflow_access} (
  sid int(10) NOT NULL default 0,
  rid int(10) NOT NULL default 0,
  grant_view tinyint(1) unsigned NOT NULL default 0,
  grant_update tinyint(1) unsigned NOT NULL default 0,
  grant_delete tinyint(1) unsigned NOT NULL default 0,
  KEY sid (sid),
  KEY rid (rid)
) /*!40100 DEFAULT CHARACTER SET utf8 */;
QUERY
);
      break;
    case 'pgsql':
      $result[] = db_query(<<<QUERY
CREATE TABLE {workflow_access} (
  sid SERIAL,
  rid integer NOT NULL default 0,
  grant_view int_unsigned NOT NULL default 0,
  grant_update int_unsigned NOT NULL default 0,
  grant_delete int_unsigned NOT NULL default 0
);
QUERY
);
      $result[] = db_query(<<<QUERY
CREATE INDEX {workflow_access}_rid_idx ON {workflow_access}(rid);
QUERY
);
  }
}

/**
 * Implementation of hook_uninstall().
 */
function workflow_access_uninstall() {
  db_query('DROP TABLE {workflow_access}');

  // Purge records from the node access table.
  node_access_rebuild();
}

Functions

Namesort descending Description
workflow_access_install Implementation of hook_install().
workflow_access_uninstall Implementation of hook_uninstall().