Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion develop-docs/self-hosted/releases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ These are the hard stops that one needs to go through:
- 23.11.0
- 24.8.0
- 25.5.1
- 26.5.1
- 26.5.1 (if you encounter `IntegrityError` error, refer to [this troubleshooting section](./troubleshooting/sentry.mdx#database-migration-issue-for-notifmsg_metric_or_workflow_exclusive-check-constraint))

Versions to avoid upgrading to:
- 23.7.0 (issues around database migrations and the Django 3 upgrade)
Expand Down
20 changes: 20 additions & 0 deletions develop-docs/self-hosted/troubleshooting/sentry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,23 @@ DELETE FROM sentry_authprovider WHERE id = 1;
```

No restart of the Sentry services is needed, and you should be able to log in with email/password immediately after running these commands.

## Database migration issue for `notifmsg_metric_or_workflow_exclusive` check constraint

During the upgrade to 26.5.0, you may encounter an error similar to this message:
```
django.db.utils.IntegrityError: check constraint "notifmsg_metric_or_workflow_exclusive" of relation "sentry_notificationmessage" is violated by some row
```

You can resolve this by running the following SQL command in your PostgreSQL database (using `docker compose exec postgres psql -U postgres -d postgres`). This will delete all rows that violate the check constraint, which should allow the migration to complete successfully. Note that this will lead to data loss in notification messages.

```sql
DELETE FROM sentry_notificationmessage WHERE NOT ((action_id IS NULL AND group_id IS NULL AND incident_id IS NOT NULL AND trigger_action_id IS NOT NULL) OR (action_id IS NOT NULL AND group_id IS NOT NULL AND incident_id IS NULL AND trigger_action_id IS NULL));
```

If that fails, you can try to drop the check constraint:
```sql
ALTER TABLE "sentry_notificationmessage" DROP CONSTRAINT "notifmsg_metric_or_workflow_exclusive";
```

Credits to [@fpotter](https://github.com/getsentry/self-hosted/issues/4341#issuecomment-4494954925) and [@acuD1](https://github.com/getsentry/self-hosted/issues/4341#issuecomment-4517103961) for the workaround.
Loading