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) »
  • Migrating 4.3.5 to 4.4.0 : Database upgrade fails
Pages: [1]

Author Topic: Migrating 4.3.5 to 4.4.0 : Database upgrade fails  (Read 1462 times)

Michaël.Si

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.4.20
Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 28, 2013, 04:25:32 am
Hello,

I have a test installation soon to be demoed and become the base for a productive one.
Very small database.

When I upgraded it from 4.3.5 to 4.4.0, the database upgrade failed after the 4.4alpha1 step.
Quote
Error: Consolidate activity contacts
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id) SELECT activity_id, target_contact_id, 3 as record_type_id FROM civicrm_activity_target [nativecode=1062 ** Duplicate entry '1-9-3' for key 'UI_activity_contact']

Strange, for a database with 50 activity contacts and no code changes whatsoever!
Activities I do have: registrations confirmed, cancelled and pending from later payment, email in, email out.

I spare you the backtrace (but kept it, so if necessary I'll post it)

Since everything in there is test data, I didn't mind losing some contact activity so I decided to restore the DB, remove the records in civicrm_activity_contact that are to be come duplicate keys, and rerun the upgrade.
Unfortunately there are several steps of this Consolidate Activities, so no luck - just went to the next error with entries from civicrm_activity_assignment inserted into civicrm_activity_contact

In the end I choose to sacrifice more data and truncate the source tables rather than the destination table
this turned out to be an incremental activity with an unpredictable time to finish... but, OK, just 3 tables.
civicrm_activity_target
civicrm_activity_assignment
civicrm_activity

It is surely not ok to tamper in this way with a live CRM DB!
So for me, the migration is done at last.
But what I f I had the thousands of contacts and activities I'm planning to have in a few months? I'd be stuck for good.

I do suppose not many others experience this - any idea how I have put my DB in this state?
No added code. Originally 4.1.5, changed server and upgraded to 4.3.5 then 4.4.0.

Thanks for looking into this, to prevent blocking some full-scale upgrades.

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: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 28, 2013, 08:31:28 am

do you have your original 4.3.5 DB so we can take a look and investigate

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

pederb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.22
  • MySQL version: MySql 5.1
  • PHP version: 5.3
Re: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 28, 2013, 11:13:35 am
I had exactly the same error today.
Can't afford losing data so must revert...

Please announce when a workaround is found...

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: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 28, 2013, 11:15:21 am

peder:

if u can share your (4.3.x) db that would be great and allow us to take a look and figure out whats happening and why. let me know if possible

thx

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

pederb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.22
  • MySQL version: MySql 5.1
  • PHP version: 5.3
Re: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 28, 2013, 11:21:58 am
Yes. Data are confidential. Can I send directly to you?

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: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 28, 2013, 11:24:26 am

yes, lobo at yahoo dot com

thx

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

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: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 28, 2013, 03:33:16 pm

I got the database file and did a quick check. That is not a valid backup file. A table: civicrm_activity_contact exists (this was introduced in 4.4), this triggers the error message.

In this case we can potentially recover and fix things, however i'm not sure what other impact the upgrade script would have. Would help to ensure you have good clean backups and do so on a regular basis (or switch to a host who can do good daily backups)

http://issues.civicrm.org/jira/browse/CRM-13665

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

pederb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.22
  • MySQL version: MySql 5.1
  • PHP version: 5.3
Re: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 29, 2013, 01:29:49 am
Thanks Lobo.

The database was actually a restored backup....
I restored after a failed upgrade but I forgot to drop the database before running the restore script, so the new table was not deleted...
Silly me...  ;)

Michaël.Si

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.4.20
Re: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 30, 2013, 02:22:49 am
Great!

Well, I'm in the same case as pederb and that's good news!

The DB and backup I used were made after an earlier attempt at upgrading to 4.4 alpha - I had a tablecivicrm_activity_contact in my 4.3.5 backup. Silly me as well.
I repeated the whole upgrade with a database drop, a restore from an earlier backup and the upgrade went fine.
Thanks for the help! And for CiviCRM.

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: Migrating 4.3.5 to 4.4.0 : Database upgrade fails
October 30, 2013, 06:57:30 am

pederb / Michaël.Si:

please do pay it forward and help other folks on the forum and/or contribute/support the project

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Migrating 4.3.5 to 4.4.0 : Database upgrade fails

This forum was archived on 2017-11-26.