[Vtigercrm-developers] anyone got a query for deleting comments?

Alan Lord alanslists at gmail.com
Sat Mar 25 11:52:29 GMT 2023


I came up with this one:

> DELETE vtiger_crmentity, vtiger_modcomments, vtiger_modcommentscf
> FROM vtiger_crmentity
> INNER JOIN vtiger_modcomments
>   ON vtiger_modcomments.modcommentsid = vtiger_crmentity.crmid
> INNER JOIN vtiger_modcommentscf
>   ON vtiger_modcommentscf.modcommentsid = vtiger_modcomments.modcommentsid
> LEFT JOIN vtiger_seattachmentsrel
>   ON vtiger_seattachmentsrel.crmid = vtiger_crmentity.crmid
> LEFT JOIN vtiger_attachments
>   ON vtiger_attachments.attachmentsid = vtiger_seattachmentsrel.attachmentsid
> WHERE vtiger_crmentity.crmid = ? 
> AND setype = 'ModComments'"

HTH

Al


On 25/03/2023 10:11, Angelo Paglialonga wrote:
> Hi Ruben, I think Alan meant that delete operation should be added to 
> comments module for server API use and record model.
> 
>> Il giorno 24 mar 2023, alle ore 17:38, Rubén A. Estrada Orozco 
>> <rulotec1 at gmail.com 
>> <mailto:rulotec1 at gmail.com>> ha scritto:
>>
>> Hi Alan,
>>
>> This is a query for deleting "orphan" comments (i.e. comments whose 
>> parent record has been deleted):
>>
>>             DELETE vtiger_modcomments, vtiger_modcommentscf
>>             FROM vtiger_modcomments
>>             LEFT JOIN vtiger_modcommentscf USING(modcommentsid)
>>             LEFT JOIN vtiger_crmentity ON related_to = crmid
>>             WHERE crmid IS NULL
>>
>> I hope it helps
>>
>> Saludos
>>
>> Rubén
>>
>>
>> On Thu, Mar 23, 2023 at 7:47 AM Alan Lord 
>> <alanslists at gmail.com 
>> <mailto:alanslists at gmail.com>> wrote:
>>
>>     Customer wants a few erroneous comments deleted. Not edited, but
>>     deleted.
>>
>>     Can't use Server API or Record model - delete is not supported.
>>
>>     Anyone else needed to do this before?
>>
>>     TIA
>>
>>     Al
>>
>>     _______________________________________________
>>     http://www.vtiger.com/ <http://www.vtiger.com/>
>>
>> _______________________________________________
>> http://www.vtiger.com/ <http://www.vtiger.com/>
> 
> 
> _______________________________________________
> http://www.vtiger.com/




More information about the vtigercrm-developers mailing list