You are here

function image_hotspots_update_7000 in Image Hotspots 7.2

Adds the language column to the image_hotspot table.

File

./image_hotspots.install, line 43

Code

function image_hotspots_update_7000() {

  // A serial field must be defined as a key, so make a temporary index on
  // 'hid' so we can safely drop the primary key.
  db_add_index('image_hotspot', 'hid', array(
    'hid',
  ));

  // Drop the primary key before adding a new field.
  db_drop_primary_key('image_hotspot');

  // Add a new field.
  $spec = array(
    'type' => 'varchar',
    'length' => 12,
    'not null' => TRUE,
    'default' => '',
    'description' => "Language code, e.g. 'de' or 'en-US'.",
  );
  db_add_field('image_hotspot', 'language', $spec);

  // Add primary key.
  db_add_primary_key('image_hotspot', array(
    'hid',
    'fid',
    'language',
  ));

  // Drop temporary added index.
  db_drop_index('image_hotspot', 'hid');
}