Skip to content

Commit

Permalink
Tweak postgres indexing fix (#2792)
Browse files Browse the repository at this point in the history
* tweak postgres indexing fix

* add exists constraint
  • Loading branch information
hubertdeng123 authored Feb 14, 2024
1 parent c3da53d commit b15d7ee
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions install/set-up-and-migrate-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ until $dc exec postgres psql -U postgres -c "select 1" >/dev/null 2>&1 || [ $RET
echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..."
sleep 1
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 exec postgres psql -qAt -U postgres -c "DROP INDEX sentry_groupedmessage_project_id_id_515aaa7e_uniq;"
fi
$dc exec postgres psql -qAt -U postgres -c "ALTER TABLE IF EXISTS sentry_groupedmessage DROP CONSTRAINT IF EXISTS sentry_groupedmessage_project_id_id_515aaa7e_uniq;"
$dc exec postgres psql -qAt -U postgres -c "DROP INDEX IF EXISTS sentry_groupedmessage_project_id_id_515aaa7e_uniq;"

if [[ -n "${CI:-}" || "${SKIP_USER_CREATION:-0}" == 1 ]]; then
$dcr web upgrade --noinput
Expand Down

0 comments on commit b15d7ee

Please sign in to comment.