You are here

workflow_access.install in Workflow 7.2

Workflow access installation.

File

workflow_access/workflow_access.install
View source
<?php

/**
 * @file
 * Workflow access installation.
 */

/**
 * Implements hook_schema().
 */
function workflow_access_schema() {
  $schema['workflow_access'] = array(
    'description' => 'Workflow access tables',
    'fields' => array(
      'sid' => array(
        'type' => 'int',
        'description' => 'The Workflow state ID.',
        'not null' => TRUE,
      ),
      'rid' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'grant_view' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_update' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_delete' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'sid',
      'rid',
    ),
    'indexes' => array(
      'rid' => array(
        'rid',
      ),
    ),
  );
  return $schema;
}

/**
 * Force rebuild of node access.
 */
function workflow_access_disable() {
  node_access_needs_rebuild(TRUE);
}

/**
 * Correct field type of field 'sid' in workflow_access table.
 */
function workflow_access_update_7001() {
  db_drop_primary_key('workflow_access');
  db_add_primary_key('workflow_access', array(
    'sid',
    'rid',
  ));
  db_drop_index('workflow_access', 'sid');
  db_drop_index('workflow_access', 'rid');
  db_change_field('workflow_access', 'sid', 'sid', array(
    'type' => 'int',
    'not null' => TRUE,
  ));
  db_drop_primary_key('workflow_access');
  db_add_primary_key('workflow_access', array(
    'sid',
    'rid',
  ));
  db_add_index('workflow_access', 'rid', array(
    'rid',
  ));
}

/**
 * Force rebuild of node access.
 */
function workflow_access_update_7002() {
  node_access_needs_rebuild(TRUE);
}

Functions

Namesort descending Description
workflow_access_disable Force rebuild of node access.
workflow_access_schema Implements hook_schema().
workflow_access_update_7001 Correct field type of field 'sid' in workflow_access table.
workflow_access_update_7002 Force rebuild of node access.