Used Zammad installation type: (source, package, docker-compose, …) package
Operating system: Debian 10.10
Browser + version:
Chrome, Edge, Firefox, private windows, to no avail
Expected behavior:
We can run the command similar to Ticket.find_by(number:20802).destroy but not one by one, I need to run the command to select multiple tickets, e.g. I wanted to delete ticket number 20800 till 20900, what is the command to accomplish this?
Actual behavior:
I didn’t find the correct command to delete ticket number 20800 till 20900
Steps to reproduce the behavior:
run rail console to delete ticket number 20800 till 20900?
Edit by MrGeneration:
Please have a backup before executing the following commands.
They will destroy data without any further warning and option to bring it back.
@rolfschmidt Thanks a lot for the information, this is more than helpful!
What I don’t understand is “have a backup before executing the following commands.” how can we back up any of these tickets and if we deleted the wrong tickets, there is a way to bring them back?
Exactly this is what I tried to add to Rolfs original answer.
I wanted to outline the potential danger in these commands to people that might not be aware.
There is a quite simple way to delete tickets through the web interface rather than using the console. You need a macro and an automation task:
First you create a Marco which adds a tag of your choice to the ticket like “deleteicket” and sets the ticket to closed. Optional you can assign the ticket to a group which is only visible for a specific user group.
Second, you create an automation which deletes the tickets which match the tag, has the state closed and belongs to the specific group if you might have set.
So every ticket which matches the criteria would be deleted when the automation runs.
Finally to delete tickets you can go the overview, select the tickets, drag and drop them on the desired macro and when the next automation is performed, the tickets will be deleted.
It is quite simple and I would guess more safe than passing the ID in the console.
Although I don’t want to provide console access to anyone else other than the server administrators. The server administrator is certainly not the same person than the zammad administrator.