Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-18345

Deleting an email address deletes any mailing events related to it, and the contact

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.4
    • Fix Version/s: 4.7.5
    • Component/s: CiviMail
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      I think this is critical, because it is 'data loss' of a sort.

      • You have sent a contact a mailing to 'email@example.com'
      • On their contact record, there is '1 Mailing' displayed
      • If you edit their email to email2@example.com there is still '1 Mailing' displayed
      • If you delete their email address, '0 Mailing'

      The same happens if you merge two contacts, and overwrite their primary email address (which triggers a delete on the email address that is overwritten).

      This is due to a foreign key constraint and 'cascade' on delete function on the 'email_id' field in the civicrm_mailing_event_queue table.

      On dev we tested removing the foreign key for email_id, and after deleting the email address the 'Mailings' for the contact stayed in tact.

      Though there are probably several knock-on effects of simply deleting the FK?

      Edit: This will probably happen for SMS etc with the FK on the phone_id column as well. So that should be deleted as well.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              john John K.
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h