v1 -> v2 MailingList table migration - #234
Merged
PatrickMTonne merged 4 commits intoMay 12, 2026
Merged
Conversation
PatrickMTonne
marked this pull request as ready for review
May 7, 2026 14:01
andresmauro17
requested review from
andresmauro17
and removed request for
andresmauro17
May 12, 2026 18:43
andresmauro17
approved these changes
May 12, 2026
andresmauro17
left a comment
There was a problem hiding this comment.
I was testing this locally using the CSV output file and the DynamoDB table.
All 31 existing records were copied correctly.
It should be fine if we can test all the records in the DB, and the code looks like it will work as expected.
Good implementation @PatrickMTonne 👍
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
Adds a one-time Django management command,
copy_to_dynamodb, that migrates v1MailingListrecords from PostgreSQL into the v2 Course Emailer's DynamoDB table so existing mailing lists continue to work after the v1 → v2 cutover. The command copies everyMailingListrow modified within a configurable window (default: the last 2 years).Summary
mailing_list/management/commands/copy_to_dynamodb.pywith flags:--table-name(required) — target DynamoDB table--dry-run— skipput_itemcalls--overwrite— replace existing items instead of skipping--max-age-years N— only copy lists modified within N years (default 2; 0 disables)--output-file PATH— per-list CSV audit trailConditionExpression="attribute_not_exists(PK)"; existing v2 items are preserved and counted asskipped_existingaccess_level=members/everyone→valid_senders=all_members,active=Trueaccess_level=staff→valid_senders=staff_only,active=Trueaccess_level=readonly→valid_senders=all_members,active=Falsecourse_settings.always_mail_staff→include_all_staff(defaults toTruewhen noCourseSettingsrow exists)date_created/date_modified→ ISO 8601 UTCcreated_at/updated_atsection_idincluded only when present;subject_prefix,sis_section_id, andnameare omitted (v2's ownsync_with_canvasbackfills them on first course access and won't clobber migrated settings)boto3added as a direct dependency inpyproject.tomlTesting
ENV=dev DJANGO_SETTINGS_MODULE=lti_emailer.settings.local uv run python manage.py copy_to_dynamodb --table-name <dev-table> --dry-run --output-file dry-run.csv--dry-run; inspect the DynamoDB table and confirm new items have correctPK/SK,active,valid_senders,include_all_staff, ISO UTC timestamps, and nosubject_prefix/sis_section_id/nameNotes