You are here

function book_access_update_6101 in Book access 6

Implements hook_update_N().

File

./book_access.install, line 135

Code

function book_access_update_6101() {
  $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;
}