Discourse Upgrade from 3.2.0 to 3.3.0 Postgress issue

Hi! I tried to upgrade my Discourse v3.2.0 instance to v3.3.0. When it was running the database migrations it failed.

Execute db:migrate
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
ERROR:  cannot drop column user_id of table invites because other objects depend on it
DETAIL:  trigger invites_user_id_readonly on table invites depends on column user_id of table invites
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

I fixed this by dropping 3 triggers in the database:

DROP TRIGGER invites_user_id_readonly ON invites;

DROP TRIGGER invites_redeemed_at_readonly ON invites;

DROP TRIGGER user_api_keys_scopes_readonly ON user_api_keys;

My actual question is, can you confirm this is an error on Discourse side? Do you have plans to fix it in the future?

I have PostgreSQL 14.10 running.

Created a PR for fixing this issue.

I’m closing that PR because I can’t reproduce the issue and nobody else reported a similar issue.

Migration::ColumnDropper.execute_drop drops the read_only function for each column with CASCADE. That also drops the trigger.

It sounds like you had a trigger that didn’t reference the read_only function. I’m not sure how you managed to do this. Are you using a standard install?