Add purpose column to NotifyLogEntry including backfill data migration#6184
Merged
jhenderson merged 2 commits intonextfrom Mar 4, 2026
Merged
Add purpose column to NotifyLogEntry including backfill data migration#6184jhenderson merged 2 commits intonextfrom
NotifyLogEntry including backfill data migration#6184jhenderson merged 2 commits intonextfrom
Conversation
e037c7b to
6163a87
Compare
thomasleese
reviewed
Mar 4, 2026
6163a87 to
0ed6035
Compare
thomasleese
reviewed
Mar 4, 2026
ac72cd4 to
a55a51f
Compare
Introduce a `purpose` enum on `NotifyLogEntry` and persist it for sent messages so we can distinguish what kind of notification failed, not just that it failed. This is the first step towards implementing consent “needs_*” sub-status logic (e.g. `needs_consent_request_failed`), enabling efficient checks for failed consent requests. Jira-Issue: MAV-502
Add a data migration to populate `notify_log_entries.purpose` from the template ID→name mapping. The mapping includes both current template IDs and historical IDs (recovered from git history) so older records can be backfilled accurately. Jira-Issue: MAV-502
a55a51f to
2928762
Compare
thomasleese
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR improves how we record and reason about outbound notifications by introducing
purposeonNotifyLogEntry. That gives us a consistent way to categorise emails/SMS (e.g., consent request vs reminder) based on the Notify template being used, and it will help implement the logic for the methodshould_be_needs_consent_request_failedinStatusGenerator::Programme(#6137)Ticket: MAV-4087
What’s changed
purposecolumn onnotify_log_entriespurposeenum toNotifyLogEntry, plus a helper to derive purpose from a template namepurposewhen creatingNotifyLogEntryrecordsNotifyLogEntry#purposefor existing rows using a mapping of historical Notify template IDs