Can't delete users in self hosted v3.4.x

Continuing the discussion from Delete a user with rails - fails:


After following fore mentioned instructions I can’t delete users neither with standard procedure from Docs»Console»Deleting Records.
I become the following message:

irb(main):123:0 ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: update or delete on table "users" violates foreign key constraint "fk_rails_08966259e8" on table "schedulers") irb(main):124:0 DETAIL: Key (id)=(27) is still referenced from table “schedulers”.
irb(main):125:0 : DELETE FROM "users" WHERE "users"."id" = $1 irb(main):126:0 irb(main):115:0> Ticket.where(customer_id:27).pluck(:id)
irb(main):127:0 => [] irb(main):128:0 irb(main):116:0> Ticket.where(owner_id:27).pluck(:id)
irb(main):129:0 => [] irb(main):130:0 irb(main):117:0> Ticket.where(created_by_id:27).pluck(:id)
irb(main):131:0 => [] irb(main):132:0 irb(main):118:0> Ticket.where(updated_by_id:27).pluck(:id)
irb(main):133:0` => []

The documentation clearly states “delete customers”.

You’re, like in the other thread, trying to remove an (ex) agent or administrator.

Fast forward to now:
Update to Zammad 3.5 and run User.find_by(email: '<email>').destroy and you’ll be fine.

Alternatively you can also use the UI based Data Privacy function that came with 3.5:

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