You are here

function book_access_update_6201 in Book access 6.2

Implements hook_update_N().

File

./book_access.install, line 255

Code

function book_access_update_6201() {
  $ret = array();
  $schema = array();
  $schema['book_access_user'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_view' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_update' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_delete' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'uid',
    ),
  );
  if (!db_table_exists('book_access_user')) {
    db_create_table($ret, 'book_access_user', $schema['book_access_user']);
  }
  if (!db_table_exists('book_access_role')) {
    db_rename_table($ret, 'book_access', 'book_access_role');
  }
  return $ret;
}