Users are experiencing an error when rebuilding their Discourse instance with the bookmarks_polymorphic feature. The error is caused by a trigger that depends on the post_id column of the bookmarks table. To resolve the issue, users can delete the trigger manually.
Carquo solved the problem by deleting the trigger manually. DeviceNull also deleted the trigger on the origin and then updating and restoring backups worked again.
Umashankar_Ankuri provided a step-by-step solution to delete the trigger and rebuild the app successfully:
Start the container and enter it.
Enter the psql command prompt.
Drop the trigger using DROP TRIGGER IF EXISTS bookmarks_polymorphic_data_sync ON bookmarks CASCADE;
Rebuild the app.
Note that DeviceNull provided an alternative method to delete the trigger using the mysql console inside the container.
Pups::ExecError: cd /var/www/discourse && su discourse -c ‘bundle exec rake db:migrate’ failed with return #<Process::Status: pid 1121 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.1.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn’
exec failed with the params {“cd”=>“$home”, “hook”=>“db_migrate”, “cmd”=>[“su discourse -c ‘bundle exec rake db:migrate’”]}
bootstrap failed with exit code 1
And with scroll up :
PG::DependentObjectsStillExist: ERROR: cannot drop column post_id of table bookmarks because other objects depend on it
DETAIL: trigger bookmarks_polymorphic_data_sync on table bookmarks depends on column post_id of table bookmarks
HINT: Use DROP … CASCADE to drop the dependent objects too.
Unfortunately on a fresh install of 3.0.0.beta16 there is no such trigger in psql that I could drop.
Yet restoring the Backup I made from a 2.9.0.beta12 fails with the same Error.
ERROR: cannot drop column post_id of table bookmarks because other objects depend on it
DETAIL: trigger bookmarks_polymorphic_data_sync on table bookmarks depends on column post_id of table bookmarks
EDIT:
Get it now - deleted trigger in the origin - updateing and restoring backups started working again - thanks for the hint
Caused by:
PG::DependentObjectsStillExist: ERROR: cannot drop column post_id of table bookmarks because other objects depend on it
DETAIL: trigger bookmarks_polymorphic_data_sync on table bookmarks depends on column post_id of table bookmarks
HINT: Use DROP ... CASCADE to drop the dependent objects too.