-
-
Notifications
You must be signed in to change notification settings - Fork 719
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
Add task to check for invalid address #12413
Add task to check for invalid address #12413
Conversation
It checks for invalid addresses, ie address with address1, city, phone or country_id set to null. It will return: - a list of invalid address in use (associated to another model) - a list of invalid address not in use, ie that we can delete
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.
Very cool. We could add it to the migration to automatically delete.... too risky?
Sounds like a good idea to me. I think that we'd do the same thing manually before the release (eg manually copy the code to each affected server, then run it, then construct a delete statement.) |
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.
If my reading is right, I think we could potentially count some addresses as unused, when they are still used. Can you please check?
next e.address_id if check_correct_address_id(e.address_id, invalid_addresses) | ||
|
||
e.business_address_id if check_correct_address_id(e.business_address_id, invalid_addresses) |
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 possible that an Enterprise has both invalid address
and business_address
?
next o.ship_address_id if check_correct_address_id(o.ship_address_id, addresses) | ||
|
||
o.bill_address_id if check_correct_address_id(o.bill_address_id, addresses) |
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.
As above, I think we could miss invalid addresses here.
Seems a bit risky, as an alternative I can printout the code to be run. |
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.
Cool, that should work 👍
What? Why?
As part of #12407, we added some migration that tighten the data validation at the database level, in particular for addresses.
These migrations will fail deployment of the database contains invalid data.
This task check for invalid data addresses and check if they are in use, ie linked to another model. It will return :
Example output :
What should we test?
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.