-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix migration failure due to config name change #921
Conversation
This alone will not replace what I was attempting to do with the ConfigValidator checks. If the
Also, I think that if the |
After this is merged + deployed to demo, should we squash all the DB migrations? The longer we leave files that reference old things around, the more painful it will get IMO |
@monfresh wrote:
I disagree with the first point. As to the second point, if whomever does the migration forgets to remove I can remove the raise/rescue. The reason it is there will not apply here (it's for problems with decryption, which typically happen because of point two above). |
@zachmargolis by "squash all the DB migrations" do you mean remove the files from the repo? I'm fine with that, after we've deployed to all existing environments. |
I have removed references to |
@pkarman yeah basically that -- by squash I mean we take the content of |
class EncryptedEmail < EncryptedAttribute | ||
def self.new_from_email(plain_email, old_uak) | ||
new_from_decrypted(plain_email, old_uak) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should old_uak
be new_uak
? When this method is called below, new_uak
is being passed as an argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, do we even need to define this here? Can we not call EncryptedAttribute#new_from_decrypted
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By stubbing out EncryptedEmail
I was trying to follow the same pattern with ActiveRecord with stubbing models in case table names ever change.
But you're right; we don't need it. I have changed in 75445b0
Agreed that we shouldn't rely on the presence of Can you think of another way to ensure that this step is done before deployment? |
In other words, if we were live in production, and we had to make sure we didn't screw this up and prevent all users from ever signing back in again, what would we do? |
If the encryption key is not set correctly, the email can't be decrypted during the migration, so the migration will fail. Previously it was skipped. Now the migration won't proceed. |
As long as we are manually managing |
75445b0
to
4ec8b87
Compare
**Why**: Two Figaro environment variables changed names, and a related class name also changed. **How**: Add fallback config names and a class definition for the old class name.
4ec8b87
to
12d6662
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
**Why**: Two Figaro environment variables changed names, and a related class name also changed. **How**: Add fallback config names and a class definition for the old class name.
**Why**: Two Figaro environment variables changed names, and a related class name also changed. **How**: Add fallback config names and a class definition for the old class name.
**Why**: Two Figaro environment variables changed names, and a related class name also changed. **How**: Add fallback config names and a class definition for the old class name.
Why: Two Figaro environment variables changed names,
and a related class name also changed.
How: Add fallback config names and a class definition
for the old class name.