CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • how to delete all activities from database
Pages: [1]

Author Topic: how to delete all activities from database  (Read 925 times)

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
how to delete all activities from database
August 14, 2014, 02:22:12 am
what is the best way to delete all activities from a MySQL database without risk damage to data integrity?
MySQL command will be of great help. Using MySQL version  5.5.35

Thank you in advance!

andrewhunt

  • I post occasionally
  • **
  • Posts: 80
  • Karma: 13
    • AGH Strategies
  • CiviCRM version: all of 'em
  • CMS version: Drupal, Joomla, and WordPress
Re: how to delete all activities from database
August 14, 2014, 06:27:09 am
The safest (and easiest) way to delete anything in bulk in CiviCRM is through the bulk actions you get from searching.  Use the Find Activities option in the menu, and simply hit Search without setting any criteria.  That'll return all activities, and from there, you can choose all records and use the Delete Activities option in the Actions dropdown that's at the top of the results.

Now, if you have contributions, event registrations, etc., those also appear as activities, and I'm not sure what the behavior is if you try to delete those activities.  I suspect one of the following
- it prevents you from deleting them
- you delete the activity, but the contribution still exists
- you end up deleting both.

You might try creating something on the demo site and experimenting with that.  If you decide those activities are worth keeping, you should use the search criteria in the Find Activities search to just select the activity types you want to clear out.
You can find me at AGH Strategies.
Need help now?  Civi911 is your go-to for CiviCRM support.

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: how to delete all activities from database
August 14, 2014, 11:23:07 am
thanks Andrew, this will work and it doesn't delete the events registration, I have no contributions either.

Dennis Gray

  • Ask me questions
  • ****
  • Posts: 472
  • Karma: 1
  • CiviCRM version: Various. See post.
  • CMS version: Drupal, Wordpress and Joomla. See post.
  • MySQL version: TBA
  • PHP version: TBA
Re: how to delete all activities from database
December 13, 2014, 08:45:04 pm
CiviCRM 4.1.5

I have been asked to delete all activities over one year old. When I use the UI (Find Activities), I get nothing but a white screen. I suppose it's timing out. Since our database goes back to 2008 or earlier, it would be a tedious process to go through each month of data.

Is there a way to do this using a SQL statement? What tables would be involved?

kennedy

  • I post occasionally
  • **
  • Posts: 119
  • Karma: 5
  • CiviCRM version: 4.5.5
  • CMS version: Drupal
  • PHP version: 5.3.10
Re: how to delete all activities from database
December 14, 2014, 01:12:57 am
have you tried deleting them in batches?

Dennis Gray

  • Ask me questions
  • ****
  • Posts: 472
  • Karma: 1
  • CiviCRM version: Various. See post.
  • CMS version: Drupal, Wordpress and Joomla. See post.
  • MySQL version: TBA
  • PHP version: TBA
Re: how to delete all activities from database
December 20, 2014, 06:43:05 pm
Yes. Our database goes back to 2008, as I mentioned. To delete in batches would be very time consuming as I only seem to be able to delete a month at a time.  I'm looking for a way to delete from the database without going through the UI.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • how to delete all activities from database

This forum was archived on 2017-11-26.