Skip to content

Bug 2085398 - Make flag_activity.who NOT NULL, add a starting flag_activity row for older flags and store the cutoff - #2830

Open
Xzzz wants to merge 1 commit into
mozilla:masterfrom
Xzzz:bug-2085398-schema
Open

Xzzz wants to merge 1 commit into
mozilla:masterfrom
Xzzz:bug-2085398-schema

Conversation

@Xzzz

@Xzzz Xzzz commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Prepares the database for #2796: makes flag_activity.who NOT NULL, gives every flag a flag_activity row, and stores the time it ran as the cutoff between bugs_activity and flag_activity. No code reads them yet, #2796 does, once this is deployed.

Changes

  • flag_activity.who becomes NOT NULL. #2808 (bug 2088705) added it nullable and writes it on every change. On MySQL its foreign key is dropped for the change and added back at the end of checksetup.
  • checksetup gives each flag that has no flag_activity row (flags last changed before flag_activity logged every type) a row with its current state, dated at its last change, in batches of 10,000 flags. It then stores the time it ran in the new one-row table flag_activity_migration, which also keeps it from running again.
  • New set_flag_activity_cutoff in Bugzilla::Test::Util, and new test t/flag-activity-start-rows.t. t/flag-activity-who.t now checks the NOT NULL change, and t/bmo/bugmail-flag-events.t sets who in its rows.

Deploy

The current code already writes who and logs every flag change to both tables, so it runs unchanged on the new schema. The backfill can take a while on production. #2796 has to be deployed in a later release.

Test plan

  • Run checksetup on a database with flags that have no flag_activity row: each gets one, flag_activity_migration holds one row, and a second run adds nothing
  • Set and clear a flag: it is saved, with who set

References

…tivity row for older flags and store the cutoff

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant