Environment:
Linux/Apache 2.4.x
PHP 7.3
Suitecrm 7.11.12
What is the best way to clean up this table and keep the related emails?
All the records seem to be the same data. Same values in folder_id and polymorphic_id fields with polymorphic_module=‘InboundEmail’.
I have stopped the InboundEmail checker job.
**Analysis on old copy of Suitecrm database **
Table->folders_rel record count: 5,4849,465
select distinct polymorphic_module from folders_rel;# polymorphic_module
- InboundEmail
- Emails
select * from folders_rel where polymorphic_module like ‘InboundEmail’ limit 5;
*** 5 records found in Emails ->mailbox_id (FK) <==> Folders_rel->polymorphic_id (FK)
folders_rel->polymorphic_id references emails->mailbox_id (not emails->id)
# id | folder_id | polymorphic_module | polymorphic_id | deleted |
---|---|---|---|---|
00000000-cae0-ad86-58d2-60c4b4b1d388 | 82e2aeca-a158-5794-6c25-5d6ef43b6540 | InboundEmail | 45e9205e-402f-22e2-3250-5d6e7db312e5 | 0 |
0000003d-4692-bf40-5a50-60b0ad34e10c | 82e2aeca-a158-5794-6c25-5d6ef43b6540 | InboundEmail | 45e9205e-402f-22e2-3250-5d6e7db312e5 | 0 |
0000009f-34f4-dcd7-65b9-60ae953b2820 | 82e2aeca-a158-5794-6c25-5d6ef43b6540 | InboundEmail | 45e9205e-402f-22e2-3250-5d6e7db312e5 | 0 |
000000f4-3a10-2eb8-c6fc-60fd1a0d47c7 | 82e2aeca-a158-5794-6c25-5d6ef43b6540 | InboundEmail | 45e9205e-402f-22e2-3250-5d6e7db312e5 | 0 |
00000168-2d02-a741-0575-6067640ffbe1 | 82e2aeca-a158-5794-6c25-5d6ef43b6540 | InboundEmail | 45e9205e-402f-22e2-3250-5d6e7db312e5 | 0 |
select * from folders_rel where polymorphic_module like ‘Emails’ limit 5;
*** 5 records found in Emails ->id (PK) <==> Folders_rel->polymorphic_id (FK)
# id | folder_id | polymorphic_module | polymorphic_id | deleted |
---|---|---|---|---|
619d3878-e5de-cadd-3ed9-5d6e7e70128c | 42f664c0-aca6-05ef-367d-5d6e7df8aaaa | Emails | 1021ff5a-bba4-1cdf-9717-5d6e7e0feb0c | 0 |
575431fe-a36a-9cc6-c2f4-5d6e82834543 | 42f664c0-aca6-05ef-367d-5d6e7df8aaaa | Emails | 102047ac-684d-70df-47a5-5d6e82bfc15b | 0 |
56b074d2-9aa1-fbed-583a-5d6e8704ea10 | 42f664c0-aca6-05ef-367d-5d6e7df8aaaa | Emails | 100e81fc-5003-1acd-581a-5d6e87379e21 | 0 |
5109ff8a-c3d3-c8bd-0de3-5d6e83618a6d | 42f664c0-aca6-05ef-367d-5d6e7df8aaaa | Emails | 1016f259-62c2-d739-0dfe-5d6e839b91b5 | 0 |
3c5c884a-7215-2f43-3369-5d6e7e40b556 | 42f664c0-aca6-05ef-367d-5d6e7df8aaaa | Emails | 1000ee80-8240-ab8b-3dee-5d6e7e555a4a | 0 |
How can safely shrink this table and avoid any more downtime?
Is this problem fixed in the latest version? .
Thanks all.