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 »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrade failure from 2.2.8 to 3.0 on Drupal
Pages: [1]

Author Topic: Upgrade failure from 2.2.8 to 3.0 on Drupal  (Read 2420 times)

Peter Chauncy

  • I’m new here
  • *
  • Posts: 17
  • Karma: 2
Upgrade failure from 2.2.8 to 3.0 on Drupal
October 07, 2009, 06:21:18 am
Hello folks,
I am getting the following error when upgrading to 3.0 on Drupal

Code: [Select]
    Sorry. A non-recoverable error has occurred.

    DB Error: already exists

    Database Error Code: Duplicate entry '2' for key 'PRIMARY', 1062

    Return to home page.

Error Details:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -5
    [message] => DB Error: already exists
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_participant_status_type
        (id, name, label, is_reserved, is_active, is_counted, weight, visibility_id)
    SELECT value, name, label, is_reserved, is_active, filter, weight, visibility_id
    FROM civicrm_option_value WHERE option_group_id = @ps_ogid [nativecode=1062 ** Duplicate entry '2' for key 'PRIMARY']
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_participant_status_type
        (id, name, label, is_reserved, is_active, is_counted, weight, visibility_id)
    SELECT value, name, label, is_reserved, is_active, filter, weight, visibility_id
    FROM civicrm_option_value WHERE option_group_id = @ps_ogid [nativecode=1062 ** Duplicate entry '2' for key 'PRIMARY']
    [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_participant_status_type
        (id, name, label, is_reserved, is_active, is_counted, weight, visibility_id)
    SELECT value, name, label, is_reserved, is_active, filter, weight, visibility_id
    FROM civicrm_option_value WHERE option_group_id = @ps_ogid [nativecode=1062 ** Duplicate entry '2' for key 'PRIMARY']"]
)

After I got the problem once, I tried the database repair tools on the 2.2 database and they cleared up a number of errors. I had the same error on the repaired database.  For what its worth here is the printout from the database tool

Code: [Select]
Repairing database civicrm30
Got version 2.2.8 from civicrm_domain.version
Using schema from CiviCRM 2.2
Dropping all foreign keys from all tables in the schema
20 rows in civicrm_note refer to rows in civicrm_participant
    that do not exist in the database.
SQL to show these rows is:
SELECT * FROM `civicrm_note`  WHERE `entity_table` = 'civicrm_participant' AND NOT ISNULL(`entity_id`) AND `entity_id` NOT IN ( SELECT id FROM `civicrm_participant` )
These rows cannot be repaired
Action: delete/no/quit [d|n|q] d
15 rows in civicrm_log refer to rows in civicrm_activity
    that do not exist in the database.
SQL to show these rows is:
SELECT * FROM `civicrm_log`  WHERE `entity_table` = 'civicrm_activity' AND NOT ISNULL(`entity_id`) AND `entity_id` NOT IN ( SELECT id FROM `civicrm_activity` )
These rows cannot be repaired
Action: delete/no/quit [d|n|q] d
1 rows in civicrm_log refer to rows in civicrm_event
    that do not exist in the database.
SQL to show these rows is:
SELECT * FROM `civicrm_log`  WHERE `entity_table` = 'civicrm_event' AND NOT ISNULL(`entity_id`) AND `entity_id` NOT IN ( SELECT id FROM `civicrm_event` )
These rows cannot be repaired
Action: delete/no/quit [d|n|q] d
20 rows in civicrm_log refer to rows in civicrm_participant
    that do not exist in the database.
SQL to show these rows is:
SELECT * FROM `civicrm_log`  WHERE `entity_table` = 'civicrm_participant' AND NOT ISNULL(`entity_id`) AND `entity_id` NOT IN ( SELECT id FROM `civicrm_participant` )
These rows cannot be repaired
Action: delete/no/quit [d|n|q] d
Adding foreign key constraints
Repair completed

Thanks,
Peter


[/code]

Peter Chauncy

  • I’m new here
  • *
  • Posts: 17
  • Karma: 2
Re: Upgrade failure from 2.2.8 to 3.0 on Drupal
October 07, 2009, 07:36:58 am
Reading the error message it seems to suggest that I have a duplicate entry or entries in civicrm_option_value related to participant status.

Which indeed I do.  

SELECT * FROM `civicrm_option_value` WHERE `option_group_id` =11

gives a list of participant status values.  The values that I take to be predefined: Attended, Cancelled, No-show, Registered, are all duplicated.

These values seem to be referred by civicrm_option_value.option_group_id plus civicrm_option_value.value rather than by id alone (as described in the table notes).  Would it therefore be safe to simply remove the duplicate entries?

Thanks,
Peter
« Last Edit: October 07, 2009, 07:55:08 am by Peter Chauncy »

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Upgrade failure from 2.2.8 to 3.0 on Drupal
October 07, 2009, 08:45:05 pm
Is your CiviCRM v2.2.8 fresh install or upgrade?

Kurund
Found this reply helpful? Support CiviCRM

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Upgrade failure from 2.2.8 to 3.0 on Drupal
October 08, 2009, 02:06:41 pm
Peter,

We did few fixes related to upgrade in v3.0.1, so can you try to upgrade and check..

Kurund
Found this reply helpful? Support CiviCRM

Peter Chauncy

  • I’m new here
  • *
  • Posts: 17
  • Karma: 2
Re: Upgrade failure from 2.2.8 to 3.0 on Drupal
October 21, 2009, 08:52:16 am
Thanks for your help.

I came back to this today and the upgrade to 3.01 went very smoothly.

I removed the duplicate entries in the civicrm_option_value table, ran the database repair tool on the database then upgraded.

Its looking good so far!

Peter

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrade failure from 2.2.8 to 3.0 on Drupal

This forum was archived on 2017-11-26.