alter database SOPM

All, Is there a way to alter a database via the SOPM to change a FK relationship? I found that I was unable to delete tickets in the system (we have a queue for deleting junky/spam tickets) when one of our custom integrations already had a db entry for it. Here is the setup Cost_estimate => FK relationship on ticket_id So when I try to delete a ticket in the system, the system complains that it's violating the FK relationship on cost_estimate. I need to update the SOPM to alter the key relationship so that deletes are okay (and will cascade/delete entries from the cost_estimates database). Additionally I need to update the TableCreate statement to include a proper FK relationship. How do I do this?? Best Regards, Mike

Hi Mike, Am 25.06.13 03:37, schrieb McMahon, Mike (HQP):
All,
Is there a way to alter a database via the SOPM to change a FK relationship?
In general, yes. You can use ForeignKeyCreate and -Drop tags for that.
I found that I was unable to delete tickets in the system (we have a queue for deleting junky/spam tickets) when one of our custom integrations already had a db entry for it.
Here is the setup
Cost_estimate => FK relationship on ticket_id
So when I try to delete a ticket in the system, the system complains that it's violating the FK relationship on cost_estimate.
I need to update the SOPM to alter the key relationship so that deletes are okay (and will cascade/delete entries from the cost_estimates database).
I don't think this will be possible. OTRS does not support specification of CASCADE at this point.
Additionally I need to update the TableCreate statement to include a proper FK relationship. How do I do this??
Just in the same way as the tables are created in OTRS itself. See otrs-schema.xml. To achieve what you need you probably have to patch Ticket::TicketDelete() to delete all referencing entities. Regards, mg -- Martin Gruner Senior Developer R&D OTRS AG Europaring 4 94315 Straubing T: +49 (0)6172 681988 0 F: +49 (0)9421 56818 18 I: www.otrs.com/ Geschäftssitz: Bad Homburg, Amtsgericht: Bad Homburg, HRB 10751, USt-Nr.: DE256610065 Aufsichtsratsvorsitzender: Burchard Steinbild, Vorstand: André Mindermann (Vorsitzender), Christopher Kuhn, Sabine Riedel Mehr als ein Help Desk-System -- Prozess- und Kundenmanagement mit OTRS 3.2 -- Jetzt Frühbucherrabatt sichern: http://www.otrs.com/de/loesungen/promotion/otrs-help-desk-32-special/

Awesome, thanks for the info - I am going to write a tickethook to take care of this! Hopefully that does the trick :) Best Regards, Mike McMahon From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Martin Gruner Sent: Tuesday, June 25, 2013 12:13 AM To: Development community of OTRS Subject: Re: [dev] alter database SOPM Hi Mike, Am 25.06.13 03:37, schrieb McMahon, Mike (HQP): All, Is there a way to alter a database via the SOPM to change a FK relationship? In general, yes. You can use ForeignKeyCreate and -Drop tags for that. I found that I was unable to delete tickets in the system (we have a queue for deleting junky/spam tickets) when one of our custom integrations already had a db entry for it. Here is the setup Cost_estimate => FK relationship on ticket_id So when I try to delete a ticket in the system, the system complains that it's violating the FK relationship on cost_estimate. I need to update the SOPM to alter the key relationship so that deletes are okay (and will cascade/delete entries from the cost_estimates database). I don't think this will be possible. OTRS does not support specification of CASCADE at this point. Additionally I need to update the TableCreate statement to include a proper FK relationship. How do I do this?? Just in the same way as the tables are created in OTRS itself. See otrs-schema.xml. To achieve what you need you probably have to patch Ticket::TicketDelete() to delete all referencing entities. Regards, mg -- Martin Gruner Senior Developer R&D OTRS AG Europaring 4 94315 Straubing T: +49 (0)6172 681988 0 F: +49 (0)9421 56818 18 I: www.otrs.com/http://www.otrs.com/ Geschäftssitz: Bad Homburg, Amtsgericht: Bad Homburg, HRB 10751, USt-Nr.: DE256610065 Aufsichtsratsvorsitzender: Burchard Steinbild, Vorstand: André Mindermann (Vorsitzender), Christopher Kuhn, Sabine Riedel Mehr als ein Help Desk-System - Prozess- und Kundenmanagement mit OTRS 3.2 - Jetzt Frühbucherrabatt sichern: http://www.otrs.com/de/loesungen/promotion/otrs-help-desk-32-special/
participants (2)
-
Martin Gruner
-
McMahon, Mike (HQP)