Merged
Conversation
The network migration (datamachine_migrate_agents_to_network_scope) consolidated agent data into base_prefix tables but left the per-site copies behind. These orphans are never queried (all repos use base_prefix) and their presence causes confusion about which table is canonical. Adds datamachine_drop_orphaned_agent_tables() which runs after the migration during activation. Guarded by its own site option flag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
datamachine_drop_orphaned_agent_tables()to clean up per-site agent tables left behind by the network migrationdatamachine_migrate_agents_to_network_scope()datamachine_orphaned_agent_tables_droppedsite option (idempotent)Problem
The network migration consolidated agent data into
c8c_datamachine_agents(base_prefix) but left orphaned per-site copies:c8c_7_datamachine_agents(events)c8c_11_datamachine_agents(wire)c8c_12_datamachine_agents(studio)_agent_accessand_agent_tokenstablesThese are never queried (all 3 repos override to
base_prefix) but their existence is confusing — the studio site had a duplicate "roadie" agent (ID 1) in its per-site table while the canonical one is ID 7 in the network table.Already cleaned up on production
The orphaned tables have been dropped manually on the live server and the flag set. This PR ensures the cleanup runs automatically on future deploys/activations.