When working on T374854: Update the GlobalBlockLookup service to support reading and applying global autoblocks, I found that the index that was changed in T376052: Allow autoblocks on IP addresses in the globalblocks table for IP addresses which are already globally blocked does not fully work as intended. This is because the gb_autoblock_parent_id column can be NULL, and MariaDB considers NULL values to not cause unique constraint violations in the same way as other values. This seems potentially different on different DBMS platforms.
Therefore, we need to convert the gb_autoblock_parent_id column to instead have values as 0 instead of NULL. Because the default was set as NULL when the column was created, we will need to make a maintenance script that updates the rows and then perform the schema change. The schema change can be made at a later time if other work is needed to be done first.
Acceptance criteria
- Update GlobalBlockManager to always write 0 for gb_autoblock_parent_id - done in d3017e1fb07c19aacc1b45b8e8592f34e7f21722
- Make a maintenance script to update values of NULL for gb_autoblock_parent_id to instead be 0
- Run this maintenance script on WMF production
- Change the schema to make the gb_autoblock_parent_id column not nullable