[BE] Update member tracking table on group transfer

Summary

In #482391 (closed) we added a new table for tracking member activity within a namespace hierarchy.

When a member is active, we update (or create, if necessary) the relevant record's timestamp.

A user that is a direct member of a group or project will have one record that associates a user to the top level namespace.

If the sub-group or project is transferred out of the namespace hierarchy it's currently in, it can either:

  1. become the sub-group or project of a different root group
  2. become a top-level group itself (only in the case of a sub-group)

In either scenario, any users that are only members of the sub-group/project will currently still have subscription_seat_assignments records pointing to the old root namespace.

Proposal

When transferring a group or project, we need to identify the relevant subscription_seat_assignments records and update or remove them.

This could be via a service/worker that could also be used when enabling the dormant member feature, to clean up any invalid records created due to this edge case.

Edited by Vijay Hawoldar