Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration fails if alert groups still reference orphaned slack messages #5422

Open
thomasmitchell opened this issue Jan 20, 2025 · 0 comments
Labels
bug Something isn't working needs triage part:chatops

Comments

@thomasmitchell
Copy link
Contributor

What went wrong?

What happened:

  • migration 0009_drop_orphaned_messages_and_fill_in_missing_team_identity_values failed due to the alerts_alertgroup table still referencing slack_message_ids that the migration attempts to delete in the slack_slackmessages table.

What did you expect to happen:

  • The migration should have succeeded - it likely should have NULLed out the slack_message_ids in the alerts_alertgroup table before attempting to delete the slack messages, similar to the way it does it for the shift swap requests table.

How do we reproduce it?

Perform this migration while there are alert groups that reference slack_message_ids corresponding to messages in the slack_slackmessages table that are about to be deleted because their channel_id is NULL (likely because their channel has been deleted, but its easy enough to mock by just nulling it yourself).

Grafana OnCall Version

Migrating from v1.11.0 to v1.14.1

Product Area

Chatops

Grafana OnCall Platform?

Kubernetes

User's Browser?

No response

Anything else to add?

I got past this manually by running the following against the database:

UPDATE alerts_alertgroup SET slack_message_id = NULL WHERE slack_message_id IN (SELECT id FROM slack_slackmessage WHERE channel_id IS NULL);
@thomasmitchell thomasmitchell added the bug Something isn't working label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage part:chatops
Projects
None yet
Development

No branches or pull requests

1 participant