Upgrade Error: migration is a blocker

Getting this:

PG::DuplicateTable: ERROR: relation "index_users_on_username_lower_trgm" already exists

So build is failing.

This seems to relate to: discourse/20230201192925_add_trigram_indexes_to_users.rb at 14cf8eacf1a679c08ea7df93aff17949d1a9c4df · discourse/discourse · GitHub

Shouldn’t I be able to do this to clear the problem?:

rake db:migrate:down VERSION=20230201192925

followed by:

rake db:migrate:up VERSION=20230201192925

Unfortunately the latter reproduces the problem, suggesting the down migration does not reset the state?

1 Like

So I did the following to resolve:

cd /var/discourse
./launcher enter app
sudo -u discourse psql
\c discourse
DROP INDEX index_users_on_username_lower_trgm;
exit

Then just to be sure:

rake db:migrate:up VERSION=20230201192925

which ran successfully this time :tada:

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.