You are here

function scald_update_7000 in Scald: Media Management made easy 7

Updates the schema from the 6.x version.

File

./scald.install, line 310

Code

function scald_update_7000() {

  // Drop the table that were just storing the results of info hooks.
  db_drop_table('scald_actions');
  db_drop_table('scald_atom_providers');
  db_drop_table('scald_contexts');
  db_drop_table('scald_contexts_type_formats');
  db_drop_table('scald_relationships');
  db_drop_table('scald_transcoders');
  db_drop_table('scald_transcoder_formats');

  // Drop the relationships support from Scald Core.
  // Better solutions for this problems exists in Contrib, now
  // that we're going for an entity-based solutions.
  db_drop_table('scald_atom_relationships');

  // Convert the 'scald_atom_types' variable, whose format changed
  // between 6.x and 7.x.
  $defaults = variable_get('scald_atom_defaults', NULL);
  if (!empty($defaults)) {
    $temp = array();
    $properties = array(
      'thumbnail_source',
      'description',
      'actions',
    );
    foreach ($properties as $property) {
      foreach ($defaults->{$property} as $name => $value) {
        $temp[$name][$property] = $source;
      }
    }
    $new_defaults = array();
    foreach ($temp as $name => $default) {
      $new_defaults[$name] = (object) $default;
    }
    variable_set('scald_atom_defaults', $new_defaults);
  }

  // TODO: Convert all the authors from the old scald_authors table
  // to new taxonomy terms of the scald_authors vocabulary.
  db_drop_table('scald_authors');
  db_drop_table('scald_atom_authors');
}