Commit 1e17ea40 authored by Derek Wright's avatar Derek Wright
Browse files

[#15380] follow-up by dww: Fix e-mail notifications during the DB update.

The schema changes for configuring e-mail contents need to happen as
soon as we create the new table or else we get bugs (and tons of
failed DB queries) when trying to send e-mail notifications while the
long flag data migration runs.
parent 75a73778
Loading
Loading
Loading
Loading
+27 −28
Changes for project_issue.install: 27 added lines, 28 removed lines.
Original line number Diff line number Diff line
@@ -759,7 +759,31 @@ function project_issue_update_6009() {
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'default' => 0, // PROJECT_ISSUE_NOTIFICATION_NONE
      ),
      'mail_body' => array(
        'description' => 'User preference for the body of notification e-mails (e.g. full history vs. only new content).',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0, // PROJECT_ISSUE_MAIL_BODY_FULL_HISTORY
      ),
      'mail_subject_project' => array(
        'description' => 'Defines if the subject of notification e-mails includes the project name.',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
      'mail_subject_category' => array(
        'description' => 'Defines if the subject of notification e-mails includes the issue category (bug, feature, etc).',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'primary key' => array('uid'),
@@ -794,6 +818,8 @@ function project_issue_update_6010() {
  if (!empty($uids)) {
    // Define a per-user default for all of them.
    foreach ($uids as $uid) {
      // We can just rely on the default value from the schema definition for
      // the other columns.
      $query = db_query("INSERT INTO {project_issue_notification_global} (uid, level) VALUES (%d, %d)", $uid, PROJECT_ISSUE_NOTIFICATION_OWN);
    }

@@ -1141,30 +1167,3 @@ function project_issue_update_6017() {
    }
  }
}

/**
 * Alter {project_issue_notification_global} for issue e-mail notification content preferences.
 */
function project_issue_update_6018() {
  $ret = array();

  $spec = array(
    'type' => 'int',
    'size' => 'tiny',
    'unsigned' => TRUE,
    'not null' => TRUE,
  );
  $spec['description'] = 'User preference for the body of notification e-mails (e.g. full history vs. only new content).';
  $spec['default'] = 0; // PROJECT_ISSUE_MAIL_BODY_FULL_HISTORY
  db_add_field($ret, 'project_issue_notification_global', 'mail_body', $spec);

  $spec['description'] = 'Defines if the subject of notification e-mails includes the project name.';
  $spec['default'] = 1;
  db_add_field($ret, 'project_issue_notification_global', 'mail_subject_project', $spec);

  $spec['description'] = 'Defines if the subject of notification e-mails includes the issue category (bug, feature, etc).';
  $spec['default'] = 1;
  db_add_field($ret, 'project_issue_notification_global', 'mail_subject_category', $spec);

  return $ret;
}