You are here

function exif_custom_update_7100 in EXIF Custom 7

Add primary keys to DB tables.

File

./exif_custom.install, line 96
Schema and update hook implementations for the EXIF Custom module.

Code

function exif_custom_update_7100() {

  // Remove existing primary keys.
  db_drop_primary_key('exif_custom_users');
  db_drop_primary_key('exif_custom_mapped_fields');
  db_drop_primary_key('exif_custom_maps');

  // Update the field.
  db_change_field('exif_custom_mapped_fields', 'exif_field', 'exif_field', array(
    'description' => 'EXIF tag name',
    'type' => 'varchar',
    'length' => '128',
    'not null' => TRUE,
    'default' => '',
  ));

  // Add the primary keys back again.
  db_add_primary_key('exif_custom_users', array(
    'uid',
  ));
  db_add_primary_key('exif_custom_mapped_fields', array(
    'mid',
    'exif_field',
  ));
  db_add_primary_key('exif_custom_maps', array(
    'mid',
  ));
}