6.3 Upgrade Failed Due to Database Issues

Infos:

  • Used Zammad version: 6.3.0-1715168141.6baf144b.focal
  • Used Zammad installation type:package
  • Operating system: ubuntu 22.04
  • Browser + version: Chrome

behavior:

I have performed an update to zammad 6.3.0. during the update process it informed me that I needed to upgrade the postgres DB to 10+. I successfully upgraded the database to version 14. Then I ran dpkg-reconfigure zammad to rerun the DB update. This time the DB error went away but now I have a bunch of upgrade errors:


PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "history_types_pkey"
DETAIL:  Key (id)=(3) already exists.
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `exec_params'
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `block (2 levels) in exec_no_cache'
[...]
Caused by:
ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "history_types_pkey" (ActiveRecord::RecordNotUnique)
DETAIL:  Key (id)=(3) already exists.
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `exec_params'
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `block (2 levels) in exec_no_cache'
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.1/lib/active_support/dependencies/interlock.rb:41:in 
[...]

Caused by:
PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "history_types_pkey" (PG::UniqueViolation)
DETAIL:  Key (id)=(3) already exists.
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `exec_params'
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `block (2 levels) in exec_no_cache'
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/zammad/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8.1/lib/active_support/dependencies/interlock.rb:41:in `permit_concurrent_loads'
[...]
`exec_params': PG::ForeignKeyViolation: ERROR:  insert or update on table "translations" violates foreign key constraint "fk_rails_8cb1380a17" (ActiveRecord::InvalidForeignKey)
DETAIL:  Key (updated_by_id)=(1) is not present in table "users".

        from /opt/zammad/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.8.1/lib/active_record/connection_adapters/postgresql_adapter.rb:768:in `block (2 levels) in exec_no_cache'
        from /opt/zammad/vendor/bundle/ruby/3.2.0/gems/activesupport-

Doing another clean postgres update fixed the issue. I’m unsure why the first one did not take. However, the issue is now resolved.

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