|
|
-- Trim a CiviCRM DB by stripping out the enormous amount of data
|
|
|
-- stored in some tables, especially the ones relating to mailing.
|
|
|
|
|
|
```
|
|
|
SET FOREIGN_KEY_CHECKS=0;
|
|
|
TRUNCATE TABLE civicrm_cache;
|
|
|
TRUNCATE TABLE civicrm_log;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_bounce;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_delivered;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_forward;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_opened;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_reply;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_trackable_url_open;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_unsubscribe;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_queue;
|
|
|
TRUNCATE TABLE civicrm_mailing_recipients;
|
|
|
TRUNCATE TABLE civicrm_mailing_spool;
|
|
|
TRUNCATE TABLE civicrm_subscription_history;
|
|
|
SET FOREIGN_KEY_CHECKS=1;
|
|
|
|
|
|
SET FOREIGN_KEY_CHECKS=0;
|
|
|
TRUNCATE TABLE civicrm_mailing_event_queue;
|
|
|
SET FOREIGN_KEY_CHECKS=1;
|
|
|
```
|
|
|
|
|
|
#1701 - Cannot truncate a table referenced in a foreign key constraint (`civiCRM`.`civicrm_mailing_event_bounce`, CONSTRAINT `FK_civicrm_mailing_event_bounce_event_queue_id` FOREIGN KEY (`event_queue_id`) REFERENCES `civiCRM`.`civicrm_mailing_event_queue` (`id`))
|
|
|
--> did it directly through mysql operations (ignore foreign checks) |
|
|
\ No newline at end of file |