[Vtigercrm-developers] Delete records from recycle bin

Alan Lord alanslists at gmail.com
Tue Jul 8 08:29:07 GMT 2025


I've been working with the customer on this and we have created a 
constraint for our custom table linked to the crmentity(crmid).

But whilst we were discussing this I also thought about the crmentityrel 
table. This is now really quite large and I suspect a lot of rows in 
this are "orphan"... When I ran a query to list any constraints for this 
table I found none. Perhaps some performance improvement could be found 
it was cleaned up?

Question is: Should there be a "delete on cascade" constraint on that 
table or not?

Thanks

Al



On 04/07/2025 09:59, Alan Lord wrote:
> A customer just asked me about this...
> 
> When they remove some records from the Recycle bin for a custom module, 
> the entry in crmentity is removed, but the rows in the module's own 
> tables are not deleted.
> 
> Looking at the Module Model for the Recycle Bin I can see why:
> 
> https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/pkg/vtiger/ 
> modules/RecycleBin/modules/RecycleBin/models/Module.php#L147
> 
> So my question is really about foreign key constraints.
> 
> When we create a new module, should the vtlib code be adding a foreign 
> key constraint and a on delete cascade?
> 
> https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/vtlib/Vtiger/ 
> ModuleBasic.php?ref_type=heads#L294
> 
> Thanks
> 
> Al
> 
> _______________________________________________
> http://www.vtiger.com/
> 




More information about the vtigercrm-developers mailing list