You are here

function imagepicker_update_1 in Image Picker 6.2

Same name and namespace in other branches
  1. 5.2 imagepicker.install \imagepicker_update_1()
  2. 5 imagepicker.install \imagepicker_update_1()

File

./imagepicker.install, line 164
imagepicker install, update and uninstall functions

Code

function imagepicker_update_1() {
  $schema['imagepicker_user_groups'] = array(
    'fields' => array(
      'gid' => array(
        'description' => t('The primary identifier for a group.'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => t('The user identifier for a group.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'group_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'group_description' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'state' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'public' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'avail_roles' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'all',
      ),
    ),
    'indexes' => array(
      'uid' => array(
        'uid',
      ),
    ),
    'primary key' => array(
      'gid',
    ),
  );
  $schema['imagepicker_group_images'] = array(
    'fields' => array(
      'gid' => array(
        'description' => t('The group identifier.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'img_id' => array(
        'description' => t('The image identifier.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
  );
  $ret = array();
  foreach ($schema as $tablename => $tableschema) {
    db_create_table($ret, $tablename, $tableschema);
  }
  return $ret;
}