Add table to log users' access from specific countries
Related to https://gitlab.com/gitlab-org/gitlab/-/issues/455706. Implements https://gitlab.com/gitlab-org/gitlab/-/work_items/468860.
What does this MR do?
This MR adds a new table named country_access_logs
and sets up its association with User
model as described below:
erDiagram
user ||--o{ country_access_log : has_many
country_access_log {
text country_code
integer access_count
datetime_with_timezone access_count_reset_at
datetime_with_timezone first_access_at
datetime_with_timezone last_access_at
}
The table will be used to keep track of:
- When a user first accessed GitLab from a specific country
- When a user last accessed GitLab from a specific country
- When a user's access count from a specific country is reset to 0
- The count of user's access from a specific country
It is used in !157579.
... and why?
Access log records will be used to notify, block, and eventually delete target users to comply with PIPL. This is described in more detail in https://gitlab.com/groups/gitlab-org/-/epics/12600.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.