You are here

function subuser_update_6002 in Subuser 6

Adds the subuser_limit table to allow us to enforce limits on the number of subusers on a per parent basis, rather than just site wide.

File

./subuser.install, line 95
Provides database schema and uninstall cleanup.

Code

function subuser_update_6002() {

  // If subuser_limit table exists, update is not necessary
  if (db_table_exists('subuser_limit')) {
    return;
  }
  $schema['subuser_limit'] = array(
    'description' => t('Holds per parent user limits on the number of subusers they can create.'),
    'fields' => array(
      'uid' => array(
        'type' => 'int',
        'description' => t('The uid of the parent.'),
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'subuser_limit' => array(
        'type' => 'int',
        'description' => t('The limit on the number of subusers this parent is allowed to create.'),
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
    'primary key' => array(
      'uid',
    ),
  );
  $ret = array();
  db_create_table($ret, 'subuser_limit', $schema['subuser_limit']);
  return $ret;
}