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) »
  • Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
Pages: [1]

Author Topic: Problem getting dashlets to appear on Dashboard. DB Error: constraint violation  (Read 1571 times)

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
November 13, 2010, 01:11:44 pm
CiviCRM 3.2.4

Problems with getting dashlets to appear on the Dashboard.

After checking the 'Available for Dashboard?' checkbox and clicking the 'Update Report' button on a report page, it returns an error of: 'Sorry. A non-recoverable error has occurred. DB Error: constraint violation'

Log attached.

Any ideas on how to fix this?

Thanks,

COS

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
November 13, 2010, 01:35:35 pm

1. can you try logging out and logging back in

2. can you also check and ensure that all your tables are InnoDB

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
November 13, 2010, 02:20:12 pm
Logging out and logging back in makes no difference.

All tables check as InnoDB.

I moved the website from one server to another. Did I break something? Any idea what?

cos

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
November 13, 2010, 03:01:35 pm

if you moved your website make sure you follow this set of instructions:

http://wiki.civicrm.org/confluence/display/CRMDOC32/Moving+an+Existing+Installation+to+a+New+Server+or+Location

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
November 13, 2010, 04:51:41 pm
Upload didn't work on last post attempt.

I believe that I am following the instructions correctly. I've moved several sites, and they have worked well after moving.

I thought that perhaps the schema was messed up, so updated that according to this post:
http://wiki.civicrm.org/confluence/display/CRMDOC32/Ensuring+Schema+Integrity+on+Upgrades

If anyone wants to update their schema with a bash script, you can try the one I wrote. It's attached.

But updating the schema didn't help. Any ideas?

COS

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
November 14, 2010, 01:08:51 pm
Hello All,

I tried logging out, truncating civicrm_acl_cache, and logging back in as suggested here:
http://forum.civicrm.org/index.php?topic=14560.0

But that didn't help.

Any ideas?

Thanks,

COS

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
November 15, 2010, 10:56:37 am
Hello All,

I thought that perhaps something was bunged up in the config_backend. Set it to NULL. Didn't help.

So the real problem is that the database has gotten out of sync with itself. Don't know how I managed to convince it to do that, but I did.

When it runs the inserts, it barfs:

INSERT INTO civicrm_dashboard_contact ( dashboard_id, contact_id )
                  VALUES  ( 16, 1 ), ( 16, 3 ), ( 16, 9 ), ( 16, 14 ), ( 16, 78 ), ( 16, 3859 ), ( 16, 4285 ), ( 16, 4293 ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`alisa_gf_net_dev_CC/civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]

Well duh, if I run

SELECT id FROM civicrm_contact;

I get
+------+
| id   |
+------+
|    1 |
| 4282 |
| 4283 |
| 4284 |
| 4285 |
| 4286 |

These ids don't exist: 3,9,14,78,3859

OK, so now the question is, where is CiviCRM getting the idea that those ids exist? What table is it pulling them from? I need to go to that table and delete those entries because they are stale.

Thanks so much,

COS
 

GingerFeet

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 4
  • CiviCRM version: 3.4.6 / 3.4.7
  • CMS version: Drupal 6.22
  • MySQL version: 5.1
  • PHP version: 5.3.6
Re: Problem getting dashlets to appear on Dashboard. DB Error: constraint violation
November 15, 2010, 12:33:45 pm
And the answer is:

TRUNCATE civicrm_dashboard_contact;

COS

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Problem getting dashlets to appear on Dashboard. DB Error: constraint violation

This forum was archived on 2017-11-26.