-
Notifications
You must be signed in to change notification settings - Fork 66
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
4: [ART] Make POA request and form adjustments migration #19997
base: master
Are you sure you want to change the base?
Conversation
ae61f34
to
4583dd1
Compare
07c2552
to
c8daeb7
Compare
4583dd1
to
51a6985
Compare
51a6985
to
d25e8f0
Compare
c8daeb7
to
dc4cb58
Compare
d25e8f0
to
9ead4aa
Compare
[:claimant_city_bidx, :claimant_state_code_bidx, :claimant_zip_code_bidx], | ||
algorithm: :concurrently | ||
|
||
add_column :ar_power_of_attorney_requests, :claimant_type, :string, null: false |
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.
Is it absolutely necessary to add columns to both models at the same time? Generally I would avoid this unless I HAVE to
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.
@ojbucao can comment but I don't see why it's necessary. Is your suggestion to split this up into two separate migrations, just so running & reverting seem cleaner?
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.
Actually, we request that indexes are modified in separate transactions migrations. I can already hear a few of you questioning this :) but we've seen things fail, and when it does, it requires a lot of work on our side. So please break this down into separate PRs for each of the index updates, and the two models (unless it's absolutely necessary the two models be updated at the same time)
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.
Different transactions or different PRs?
All of these tables should have 0 records in all deployed environments as this isn't yet a production feature, or even one that's been tested in staging, does that make a difference to you?
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.
(I agree with the guidance on having index updates in separate transactions, just not sure of the case for making them separate PRs, they'll run separately anyway if split up into diff migrations no)
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.
I can split these up into separate migrations.
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.
guys - I didn't make the rules. Fighting me is only going to get your work less attention.
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.
I had intended to say migrations, which we generally would split into PRs, and is why I stated it that way. I suppose separate migrations in the same PR is ok.
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.
I wasn't trying to fight you on the rules! Correct me if I'm wrong and I will apologize profusely but you said two separate things, one of which was transparently reasonable and one of which was harder to understand, and I was trying to distinguish:)
@@ -0,0 +1,24 @@ | |||
class MakePoaRequestAndFormAdjustments < ActiveRecord::Migration[7.1] | |||
disable_ddl_transaction! |
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.
Not sure if this is necessary, since these tables should have 0 records in all fields, do we know why it's in here or just out of habit/pattern-matching?
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.
probably just habit. actually no, db:migrate throws an error without it.
d5b0665
to
996bca0
Compare
996bca0
to
5e4c619
Compare
5e4c619
to
4284620
Compare
@ojbucao I was looking over the PR when you force pushed - I'm keeping an eye out for your team approval, then we'll be good to go |
Thank you! |
@@ -0,0 +1,6 @@ | |||
class RemoveOldIndicesFromPoaForms < ActiveRecord::Migration[7.1] |
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.
I want to note here that I brought this up in the CoP this morning, and that while it's not always necessary, we generally recommend following the same patterns for removing indexes as we do for adding (regarding transactions/concurrency). Considering there aren't any records in the table, we'll let it go here.
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.
I understand the reasoning here, but I’d lean towards sticking with our pattern of using algorithm: :concurrently
even if it seems unnecessary in this case. It ensures consistency and might reduce risk if the migration is ever redone in a different context. Would it make sense to make that change as a precaution?
Lastly I'll mention that in the future, we'd generally recommend/request separate PRs for the various types of migrations, just because they're easier to revert if, for example, the 3rd out of 5 migrations fail for whatever reason, and can't be easily rolled back because it's outside of a transaction. But in this case, as we're dealing with models without any data (in production... I didn't look at staging), and they're related operations on the same table, we're ok with letting them go in together this time. Thanks for breaking them up, though |
2 Removed obsolete columns: city_bidx, state_bidx, zipcode_bidx 3 Added new columns: claimant_city_ciphertext, claimant_city_bidx, claimant_state_code_ciphertext, claimant_state_code_bidx, claimant_zip_code_ciphertext, claimant_zip_code_bidx 4 Added a new index for claimant_city_bidx, claimant_state_code_bidx, and claimant_zip_code_bidx 5 Added claimant_type column to ar_power_of_attorney_requests
4284620
to
672fcff
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.
Giving this a 👍 but please keep an eye on things when you merge (dev and staging). Due to the use of disable_ddl_transaction
, the index removal is not wrapped in a transaction, which means that if something goes wrong during the migration process, the index could be left in a partially removed state, requiring manual intervention to resolve
Description
This PR adds a migration to modify the Power of Attorney forms table structure by:
Details