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 CiviContribute (Moderator: Donald Lobo) »
  • Deleting Contributions Through MySQL Queries
Pages: [1]

Author Topic: Deleting Contributions Through MySQL Queries  (Read 259 times)

Max Hunter

  • I’m new here
  • *
  • Posts: 21
  • Karma: 1
  • CiviCRM version: 4.4.x
  • CMS version: Drupal 7
Deleting Contributions Through MySQL Queries
September 26, 2014, 11:26:21 am
Hi All!

I need some help letting go of baggage from the past -- specifically, decade-old bad contribution data.  I'm working on an instance with hundreds of thousands of erroneous contributions (all failed, all with the same timestamp, but spread out over ~3k contacts) that are throwing foreign key constraint errors when I try to upgrade to 4.5.  Deleting them all through the UI isn't really an option, but I'm apprehensive about deleting them through MySQL because an incomplete import query was what got us into this FK mess to begin with. 

Basically, I want to find all the tables that have rows corresponding to an individual contribution so that I can make sure I'm deleting completely.  Can anyone guess which file in the codebase might contain this info?  Happy to sleuth around on this, but it would be great if someone could point me in the right direction.  Definitely willing to add this to the "fixing your messy data"/"Installation troubleshooting" section of the wiki!

Max
« Last Edit: September 26, 2014, 11:29:38 am by Max Hunter »

Dan C

  • I post frequently
  • ***
  • Posts: 179
  • Karma: 17
  • CiviCRM version: All
  • CMS version: Joomla 2.5 and 3.X, Drupal 7, Wordpress 3.7 and up
  • MySQL version: 5.1.7 and up
  • PHP version: 5.3.5 and up
Re: Deleting Contributions Through MySQL Queries
September 26, 2014, 06:33:34 pm
If these were imported into 4.4 or 4.3 then you are going to be looking for data in the civicrm_contribution, civicrm_financial_item, and civicrm_financial_trxn tables.  Depending on the type of transaction this was though, they could be linked to things like membership records, event participant records, etc.  Depending on what the errors actually are, you might be able to fix your upgrade problem by checking your databases schema integrity (it's worked for me in the past).  There are instructions on the Wiki at http://wiki.civicrm.org/confluence/display/CRMDOC/Ensuring+Schema+Integrity+on+Upgrades.
CrusonWeb - Web Development, Implementation, and Support.  Specializing in CiviCRM and Joomla (although also knowledgable in Wordpress and Drupal as well).

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Deleting Contributions Through MySQL Queries

This forum was archived on 2017-11-26.