Page MenuHomePhabricator

Add a default for the *_agent columns in the CheckUser result tables
Closed, InvalidPublic

Description

Summary

We need to add a default value for the *_agent columns (i.e. cuc_agent, cule_agent, cupe_agent) so that we can stop writing to these columns in T361205

Proposed schema changes

Add a default value of an empty string to cuc_agent, cule_agent, and cupe_agent in their respective tables:

describe cu_changes;
+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
...
| cuc_agent      | varbinary(255)      | YES  |     |         |                |
| cuc_agent_id   | bigint(20) unsigned | NO   |     | 0       |                |
+----------------+---------------------+------+-----+---------+----------------+
describe cu_log_event;
+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
...
| cule_agent     | varbinary(255)      | YES  |     |         |                |
| cule_agent_id  | bigint(20) unsigned | NO   |     | 0       |                |
+----------------+---------------------+------+-----+---------+----------------+
describe cu_private_event;
+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
...
| cupe_agent     | varbinary(255)      | YES  |     |         |                |
| cupe_agent_id  | bigint(20) unsigned | NO   |     | 0       |                |
+----------------+---------------------+------+-----+---------+----------------+

Acceptance criteria

  • The schema change is merged in the master branch of the CheckUser extension
  • Code is added to the CheckUserInsert service to support not writing to these columns
  • A Schema-change-in-production ticket is filed to apply the change on WMF wikis

Event Timeline

I now see that the *_agent columns already have a default set of null. Using the following query confirms this:

MariaDB [my_database]> insert into cu_changes (cuc_actor, cuc_comment_id, cuc_timestamp) values (1, 1, 'test');
Query OK, 1 row affected (0.034 sec)

MariaDB [my_database]> select * from cu_changes order by cuc_id desc limit 1;
+--------+---------------+-----------+-----------+----------------+-----------+-------------+----------------+----------------+----------+----------------+--------+------------+---------+-------------+-----------+--------------+
| cuc_id | cuc_namespace | cuc_title | cuc_actor | cuc_comment_id | cuc_minor | cuc_page_id | cuc_this_oldid | cuc_last_oldid | cuc_type | cuc_timestamp  | cuc_ip | cuc_ip_hex | cuc_xff | cuc_xff_hex | cuc_agent | cuc_agent_id |
+--------+---------------+-----------+-----------+----------------+-----------+-------------+----------------+----------------+----------+----------------+--------+------------+---------+-------------+-----------+--------------+
|   2407 |             0 |           |         1 |              1 |         0 |           0 |              0 |              0 |        0 | test           |        | NULL       |         | NULL        | NULL      |            0 |
+--------+---------------+-----------+-----------+----------------+-----------+-------------+----------------+----------------+----------+----------------+--------+------------+---------+-------------+-----------+--------------+
1 row in set (0.003 sec)
Dreamy_Jazz changed the task status from Declined to Invalid.Jan 5 2026, 1:09 PM