You are here

function editor_note_update_7002 in Editor Notes 7

Updates blank text_format to the default 'plain_text' format.

File

./editor_note.install, line 118
Database schema and installations tasks for Editor Notes module.

Code

function editor_note_update_7002() {
  $blank_text_format_notes = db_query('SELECT en.id FROM {editor_note} en WHERE text_format = :text_format', array(
    ':text_format' => '',
  ))
    ->fetchAll();
  foreach ($blank_text_format_notes as $item) {
    $ids[] = $item->id;
  }
  if (!empty($ids)) {
    db_update('editor_note')
      ->fields(array(
      'text_format' => EDITOR_NOTE_DEFAULT_TEXT_FORMAT,
    ))
      ->condition('id', $ids, 'IN')
      ->execute();
  }
}