Create table and model for user's phone number validations
What does this MR do and why?
Creates a table and model to store user's phone number validations for https://gitlab.com/groups/gitlab-org/modelops/anti-abuse/-/epics/3. The following considerations have been made:
- Following from the UI MR !96529 (merged), we will need to store the phone number, international dial code and country (to be able to pre-populate the UI in case the user exists the process mid-way).
- We are going to be using an external service, TeleSign to send + verify a code. Hence we are storing a
telesign_reference_xid
. - We also need to store a risk score for the phone number. This will be used by the Trust & Safety team.
- We need to ensure that phone numbers that are linked to a banned user cannot be used again. Hence the index on
international_dial_code, phone_number
. - Every user just has 1 phone number validation, exactly like
credit_card_validations
table.
Screenshots or screen recordings
Output of db:migrate
main: == 20220913043728 CreateUserPhoneNumberValidations: migrating =================
main: -- create_table(:user_phone_number_validations, {:id=>false})
main: -- quote_column_name(:country)
main: -> 0.0000s
main: -- quote_column_name(:phone_number)
main: -> 0.0000s
main: -- quote_column_name(:telesign_reference_xid)
main: -> 0.0000s
main: -> 0.0075s
main: == 20220913043728 CreateUserPhoneNumberValidations: migrated (0.0078s) ========
Output of db:rollback
main: == 20220913043728 CreateUserPhoneNumberValidations: reverting =================
main: -- drop_table(:user_phone_number_validations)
main: -> 0.0040s
main: == 20220913043728 CreateUserPhoneNumberValidations: reverted (0.0059s) ========
db:gitlabcom-database-testing results
Query Plan for related_to_banned_user?
How to set up and validate locally
- Run the migration with
$ bin/rake db:migrate RAILS_ENV=development
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/78
Edited by Hinam Mehra