-
Notifications
You must be signed in to change notification settings - Fork 1
Set Person.Trn to be non-nullable [DO NOT MERGE] #2688
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
base: main
Are you sure you want to change the base?
Conversation
15a76d2 to
5a79dd1
Compare
3968eb0 to
f1e3888
Compare
| builder.HasIndex(p => p.DqtContactId).HasFilter("dqt_contact_id is not null").IsUnique(); | ||
| builder.HasIndex(p => p.MergedWithPersonId).HasFilter("merged_with_person_id is not null"); | ||
| builder.HasIndex(p => p.Trn).HasFilter("trn is not null").IsUnique(); | ||
| builder.HasIndex(p => p.Trn).IsUnique(); |
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 want an .IsCreatedConcurrently() on this otherwise we might have timeout issues deploying on prod.
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.
Oh right - just looked at postgres docs and it says
Another difference is that a regular CREATE INDEX command can be performed within a transaction block, but CREATE INDEX CONCURRENTLY cannot
Is that going to be an issue?
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.
It's best to put the CreateIndex into its own migration to mitigate that
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.
Given the difficulty with this, it might be simpler to leave the index as-is
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.
Having potential timeouts on prod seems worrying though?
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.
Oh you mean leave the filter in place. Sure can do that
f1e3888 to
a1e0e0a
Compare
DO NOT MERGE UNTIL DELETE JOB HAS BEEN RUN ON ALL ENVIRONMENTS
Otherwise the migration will fail due to null TRNs
Environments to run job on first
Context
Once we’ve run the job to delete records without a TRN we should make the TRN column on person non-nullable to ensure no more records are created without a TRN. (It’ll also tidy up our nullable annotations and prevent the need for !s everywhere where we know we have a TRN.)
Changes proposed in this pull request
Checklist