From 2346a697677dbca31c089d13368d950d8d06988f Mon Sep 17 00:00:00 2001 From: Hubert Deng Date: Thu, 8 Feb 2024 13:03:09 -0800 Subject: [PATCH] Fix groupedmessage indexing error (#2777) * fix groupedmessage indexing error --- install/set-up-and-migrate-database.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/install/set-up-and-migrate-database.sh b/install/set-up-and-migrate-database.sh index 6e393bb994..1b8adf781d 100644 --- a/install/set-up-and-migrate-database.sh +++ b/install/set-up-and-migrate-database.sh @@ -1,5 +1,13 @@ echo "${_group}Setting up / migrating database ..." +# Fixes https://github.com/getsentry/self-hosted/issues/2758, where a migration fails due to indexing issue +$dc up -d postgres +timeout 90s bash -c "until $dc exec postgres pg_isready ; do sleep 5 ; done" +indexes=$($dc exec postgres psql -qAt -U postgres -c "SELECT indexname, indexdef FROM pg_indexes WHERE tablename = 'sentry_groupedmessage';") +if [[ $indexes == *"sentry_groupedmessage_project_id_id_515aaa7e_uniq"* ]]; then + $dc postgres psql -qAt -U postgres -c "DROP INDEX sentry_groupedmessage_project_id_id_515aaa7e_uniq;" +fi + if [[ -n "${CI:-}" || "${SKIP_USER_CREATION:-0}" == 1 ]]; then $dcr web upgrade --noinput echo ""