Conversation
Refactors guild purge into explicit indirect, ordered, and legacy table groups to prevent FK violations and cover previously missed guild-scoped data (including panel children, KB, labels, and experiment/gallery records). Adds a shared purge helper with per-table logging and relation existence checks so missing legacy tables no longer abort the whole purge transaction. Also updates module metadata and bumps `github.com/TicketsBot-cloud/common` (with local replace) plus `golang.org/x/sys`.
9 tasks
Member
|
Good to bump common when you're ready @biast12 |
Contributor
Author
|
Bumped!!! |
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.
Description
PurgeGuildDatahas a hardcoded table list that nothing keeps in sync with the schema. It was correct when written (ea0f319, 2026-01-06) and has drifted since, so guild purges fail and the guild is retried every 6 hours forever.Two independent faults:
DELETE FROM ticketsraises 23503. The 2026.08 release (53077b5) addedticket_message_countswithFOREIGN KEY(guild_id, ticket_id) REFERENCES tickets(...)and noON DELETEaction, and never added it to the purge list.webhookshas the same FK shape and is in the list, but sits 41 entries aftertickets— dormant only because webhook rows exist solely for open tickets.CREATE TABLEany more. 53077b5 deleted thearchive_channel,naming_scheme,ticket_limit,ticket_permissionsandwelcome_messageswrappers but left them inguildpurge.go. ADELETEagainst a missing relation raises 42P01 and aborts the whole transaction.For: TicketsBot-cloud/cleanupdaemon#4
Type of Change
Checklist