187384622/new email model - PR2 - Add Email Address Data Migration Script #50
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.
Pivotal Tracker Link
What this PR does:
This pull request is the second in a series intended to facilitate easier code review. The first PR can be found here. For this PR, there is only one file change, which aims to safely migrate the email address data (
email
&personal_email
) in theteacher
model to the newemail_address
model (no deletion of emails from Teacher model), with comprehensive loggingInclude screenshots, videos, etc.
Below are some screenshots of testing the db before & after running the script.
Before Script: 50 teachers with original teacher model & 2 teachers (the admins) with email addresses already in the
email_address
modelThe testing data was generated by the below command, and the seed data in the PR1
The command:
After this command
DB State for
Teacher
DB State for
EmailAddress
Frontend View Effect
After Script: 50 teachers with original teacher model & 2 teachers (the admins) with email addresses already in the
email_address
modelAfter running the script with the command
rake email_address_migration:migrate_email_addresses
, the output isDB State for
Teacher
DB State for
##### Frontend View EffectEmailAddress
Who authored this PR?
How should this PR be tested?
YES, there are edge cases.
Teacher
. They will be removed at next PR which drops theemail
&personal_email
column fromTeacher
email
andpersonal_email
should successfully get migrated toEmailAddress
Are there any complications to deploying this?
This script touches the db, but it doesn't hurt existing data (no deletions for existing data). Check my above testings.
Checklist:
michael/12345-add-new-feature
Any branch name will do as long as the story ID is there. You can usegit checkout -b [new-branch-name]
)