Can't delete users from the CLI

Infos:

  • Used Zammad version: 3.3.x
  • Used Zammad installation source: (source, package, …) package
  • Operating system: 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Hello,

I get an error when I try to delete a user:

zammad run rails c

Loading production environment (Rails 5.2.4.1)
irb(main):001:0> User.find(60)
=> #<User id: 60, organization_id: nil, login: “timpham1@yahoo.com”, firstname: “Xavier”, lastname: “Bartoletti”, email: “timpham1@yahoo.com”, image: nil, image_source: nil, web: “”, password: “$argon2id$v=19$m=65536,t=2,p=1$+qLEKUeCJFpBDwEjpk2…”, phone: “”, fax: “”, mobile: “”, department: “”, street: “”, zip: “”, city: “”, country: “”, address: “”, vip: false, verified: false, active: true, note: “”, last_login: “2020-07-26 15:22:46”, source: “signup”, login_failed: 0, out_of_office: false, out_of_office_start_at: nil, out_of_office_end_at: nil, out_of_office_replacement_id: nil, preferences: {“locale”=>“en-us”}, updated_by_id: 60, created_by_id: 1, created_at: “2020-07-26 15:22:45”, updated_at: “2020-07-26 15:22:51”>
irb(main):002:0> User.find(60).destroy()
Traceback (most recent call last):
1: from (irb):2
ActiveRecord::StatementInvalid (Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails (zammad.users, CONSTRAINT fk_rails_355a7ffe95 FOREIGN KEY (updated_by_id) REFERENCES users (id)): DELETE FROM users WHERE users.id = 60)
irb(main):003:0>

Any ideas?

Update:
Most users can be deleted if I remove the them from the customer group, but not all.

Do yourself a favor and use our official provided scripts - they will safe head ache.

https://docs.zammad.org/en/latest/admin/console/dangerzone-for-experts.html

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