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) »
  • Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
Pages: [1]

Author Topic: Upgrading 3.1.4 (3.15, 3.1.6) to 3.4  (Read 1115 times)

rajendra

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
April 28, 2011, 11:51:48 pm
i'm running drupal with civicrm 3.1.4. when i try to run civicrm/upgrade?reset=1 to upgrade directly to 3.4.0 i see the "Upgrade CiviCRM to Version" page. then when i click the "Upgrade Now" button (and click OK to the "Are you sure you are ready to upgrade now?" popup)  i get this error "DB Error: already exists." below are more "Error Details."

i've successfully upgraded to 3.1.5 and 3.1.6 and tried to upgrade to 3.4 from those version with the same problem. i've also attempted to upgrade to 3.2.0 and 3.2.1 and also got the error "DB Error: already exists."

any suggestion of potential solutions would be greatly appreciated. thanks.


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

    [code] => -5
    [message] => DB Error: already exists
    [mode] => 16
    [debug_info] => CREATE TABLE `civicrm_entity_financial_trxn` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `entity_table` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `entity_id` int(10) unsigned NOT NULL,
  `financial_trxn_id` int(10) unsigned DEFAULT NULL,
  `amount` decimal(20,2) NOT NULL COMMENT 'allocated amount of transaction to this entity',
  PRIMARY KEY (`id`),
  KEY `FK_civicrm_entity_financial_trxn_financial_trxn_id` (`financial_trxn_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci [nativecode=1050 ** Table 'civicrm_entity_financial_trxn' already exists]
    [type] => DB_Error
    [user_info] => CREATE TABLE `civicrm_entity_financial_trxn` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `entity_table` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `entity_id` int(10) unsigned NOT NULL,
  `financial_trxn_id` int(10) unsigned DEFAULT NULL,
  `amount` decimal(20,2) NOT NULL COMMENT 'allocated amount of transaction to this entity',
  PRIMARY KEY (`id`),
  KEY `FK_civicrm_entity_financial_trxn_financial_trxn_id` (`financial_trxn_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci [nativecode=1050 ** Table 'civicrm_entity_financial_trxn' already exists]
    [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="CREATE TABLE `civicrm_entity_financial_trxn` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `entity_table` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `entity_id` int(10) unsigned NOT NULL,
  `financial_trxn_id` int(10) unsigned DEFAULT NULL,
  `amount` decimal(20,2) NOT NULL COMMENT 'allocated amount of transaction to this entity',
  PRIMARY KEY (`id`),
  KEY `FK_civicrm_entity_financial_trxn_financial_trxn_id` (`financial_trxn_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci [nativecode=1050 ** Table 'civicrm_entity_financial_trxn' already exists]"]
)
« Last Edit: April 29, 2011, 07:39:27 pm by rajendra »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
April 29, 2011, 01:56:34 am
The issue appears to be that the upgrader is trying to create a table which already exists in your database, probably from a failed upgrade attempt.

What I would suggest is you you DROP that table (i.e. civicrm_entity_financial_trxn) from your database and then try the upgrade.

Be sure to backup your database before doing this, just in case (not sure how) there is some data in that table.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

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: Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
April 29, 2011, 01:58:09 am
May be check DB integrity before upgrade: http://wiki.civicrm.org/confluence/display/CRMDOC31/Ensuring+Schema+Integrity+on+Upgrades

Kurund
Found this reply helpful? Support CiviCRM

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
April 29, 2011, 02:01:03 am
Good suggestion. Wasn't there a database integrity checking script? I can't find it now.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

rajendra

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
Re: Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
April 29, 2011, 05:25:05 pm
thanks for the quick suggestions.

i did try to remove the offending table civicrm_entity_financial_trxn, ran it again and got the same error with civicrm_financial_account. niether of those tables had any data. then i ran it and it gave me the same error for civicrm_website, which does have a lot of data. at that point i figured there must be something else wrong besides the table existing when it shouldn't exist. i know civicrm_website should already exist.

i will try to check DB integrity and see what that finds.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
April 29, 2011, 05:36:47 pm
When you try to upgrade, & then back out & restore back to the back-up extra tables created during the failed upgrade are not removed unless you drop & recreate your database. So, if you try an upgrade & go back for any reason these tables will be lying in wait to cause havoc later :-)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

rajendra

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
Re: Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
April 29, 2011, 05:46:22 pm
ok. i started over from the original 3.1.4 data. this time on running the upgrade script for 3.4.0 i got the following error. i'm going to go though checking DB integrity and see if that makes a difference.


Database Error Code: Cannot add or update a child row: a foreign key constraint fails

Code: [Select]
(`cirf_civicrm_development`.`civicrm_uf_field`, CONSTRAINT `FK_civicrm_uf_field_location_type_id` FOREIGN KEY (`location_type_id`) REFERENCES `civicrm_location_type` (`id`) ON DELETE SET NULL), 1452</div>
                                        <div class="crm-section">Additional Details: <p><pre>Array
(
    [callback] =&gt; Array
        (
            [0] =&gt; CRM_Core_Error
            [1] =&gt; handle
        )

    [code] =&gt; -3
    [message] =&gt; DB Error: constraint violation
    [mode] =&gt; 16
    [debug_info] =&gt; INSERT INTO civicrm_uf_field
   ( uf_group_id, field_name, is_required, is_reserved, weight, visibility, in_selector, is_searchable, location_type_id, label,field_type ) VALUES
   ( @uf_group_id_summary,           'phone' ,1,        0, 1,     'User and User Admin Only',   0,   0, 1,   'Home Phone', 'Contact'),
   ( @uf_group_id_summary,           'phone' ,1,      0, 2,     'User and User Admin Only',   0,      0, 2,   'Home Mobile', 'Contact' ),
   ( @uf_group_id_summary, 'street_address',   1,    0, 3,   'User and User Admin Only',   0,   0, NULL,    'Primary Address',         'Contact' ),
   ( @uf_group_id_summary, 'city',   1,    0, 4,   'User and User Admin Only',   0,   0, NULL,    'City',  'Contact' ),
   ( @uf_group_id_summary, 'state_province',   1,    0, 5,   'User and User Admin Only',   0,   0, NULL,    'State',  'Contact' ),
   ( @uf_group_id_summary, 'postal_code',   1,    0, 6,   'User and User Admin Only',   0,   0, NULL,    'Postal Code',  'Contact' ),
   ( @uf_group_id_summary, 'email',   1,    0, 7,   'User and User Admin Only',   0,   0, NULL,    'Primary Email',  'Contact' ),
   ( @uf_group_id_summary, 'group',   1,    0, 8,   'User and User Admin Only',   0,   0, NULL,    'Groups',  'Contact' ),
   ( @uf_group_id_summary, 'tag',   1,    0, 9,   'User and User Admin Only',   0,   0,      NULL,    'Tags', 'Contact' ),
   ( @uf_group_id_summary,           'gender',    1,         0,  10,  'User and User Admin Only',   0,    0,  NULL,  'Gender',  'Individual' ),
   ( @uf_group_id_summary,      'birth_date',   1,         0, 11, 'User and User Admin Only',   0,   0, NULL,   'Date of Birth',     'Individual' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cirf_civicrm_development`.`civicrm_uf_field`, CONSTRAINT `FK_civicrm_uf_field_location_type_id` FOREIGN KEY (`location_type_id`) REFERENCES `civicrm_location_type` (`id`) ON DELETE SET NULL)]
    [type] =&gt; DB_Error
    [user_info] =&gt; INSERT INTO civicrm_uf_field
   ( uf_group_id, field_name, is_required, is_reserved, weight, visibility, in_selector, is_searchable, location_type_id, label,field_type ) VALUES
   ( @uf_group_id_summary,           'phone' ,1,        0, 1,     'User and User Admin Only',   0,   0, 1,   'Home Phone', 'Contact'),
   ( @uf_group_id_summary,           'phone' ,1,      0, 2,     'User and User Admin Only',   0,      0, 2,   'Home Mobile', 'Contact' ),
   ( @uf_group_id_summary, 'street_address',   1,    0, 3,   'User and User Admin Only',   0,   0, NULL,    'Primary Address',         'Contact' ),
   ( @uf_group_id_summary, 'city',   1,    0, 4,   'User and User Admin Only',   0,   0, NULL,    'City',  'Contact' ),
   ( @uf_group_id_summary, 'state_province',   1,    0, 5,   'User and User Admin Only',   0,   0, NULL,    'State',  'Contact' ),
   ( @uf_group_id_summary, 'postal_code',   1,    0, 6,   'User and User Admin Only',   0,   0, NULL,    'Postal Code',  'Contact' ),
   ( @uf_group_id_summary, 'email',   1,    0, 7,   'User and User Admin Only',   0,   0, NULL,    'Primary Email',  'Contact' ),
   ( @uf_group_id_summary, 'group',   1,    0, 8,   'User and User Admin Only',   0,   0, NULL,    'Groups',  'Contact' ),
   ( @uf_group_id_summary, 'tag',   1,    0, 9,   'User and User Admin Only',   0,   0,      NULL,    'Tags', 'Contact' ),
   ( @uf_group_id_summary,           'gender',    1,         0,  10,  'User and User Admin Only',   0,    0,  NULL,  'Gender',  'Individual' ),
   ( @uf_group_id_summary,      'birth_date',   1,         0, 11, 'User and User Admin Only',   0,   0, NULL,   'Date of Birth',     'Individual' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cirf_civicrm_development`.`civicrm_uf_field`, CONSTRAINT `FK_civicrm_uf_field_location_type_id` FOREIGN KEY (`location_type_id`) REFERENCES `civicrm_location_type` (`id`) ON DELETE SET NULL)]
    [to_string] =&gt; [db_error: message=&quot;DB Error: constraint violation&quot; code=-3 mode=callback callback=CRM_Core_Error::handle prefix=&quot;&quot; info=&quot;INSERT INTO civicrm_uf_field
   ( uf_group_id, field_name, is_required, is_reserved, weight, visibility, in_selector, is_searchable, location_type_id, label,field_type ) VALUES
   ( @uf_group_id_summary,           'phone' ,1,        0, 1,     'User and User Admin Only',   0,   0, 1,   'Home Phone', 'Contact'),
   ( @uf_group_id_summary,           'phone' ,1,      0, 2,     'User and User Admin Only',   0,      0, 2,   'Home Mobile', 'Contact' ),
   ( @uf_group_id_summary, 'street_address',   1,    0, 3,   'User and User Admin Only',   0,   0, NULL,    'Primary Address',         'Contact' ),
   ( @uf_group_id_summary, 'city',   1,    0, 4,   'User and User Admin Only',   0,   0, NULL,    'City',  'Contact' ),
   ( @uf_group_id_summary, 'state_province',   1,    0, 5,   'User and User Admin Only',   0,   0, NULL,    'State',  'Contact' ),
   ( @uf_group_id_summary, 'postal_code',   1,    0, 6,   'User and User Admin Only',   0,   0, NULL,    'Postal Code',  'Contact' ),
   ( @uf_group_id_summary, 'email',   1,    0, 7,   'User and User Admin Only',   0,   0, NULL,    'Primary Email',  'Contact' ),
   ( @uf_group_id_summary, 'group',   1,    0, 8,   'User and User Admin Only',   0,   0, NULL,    'Groups',  'Contact' ),
   ( @uf_group_id_summary, 'tag',   1,    0, 9,   'User and User Admin Only',   0,   0,      NULL,    'Tags', 'Contact' ),
   ( @uf_group_id_summary,           'gender',    1,         0,  10,  'User and User Admin Only',   0,    0,  NULL,  'Gender',  'Individual' ),
   ( @uf_group_id_summary,      'birth_date',   1,         0, 11, 'User and User Admin Only',   0,   0, NULL,   'Date of Birth',     'Individual' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cirf_civicrm_development`.`civicrm_uf_field`, CONSTRAINT `FK_civicrm_uf_field_location_type_id` FOREIGN KEY (`location_type_id`) REFERENCES `civicrm_location_type` (`id`) ON DELETE SET NULL)]&quot;]
)
« Last Edit: April 29, 2011, 06:38:52 pm by rajendra »

rajendra

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
Re: Upgrading 3.1.4 (3.15, 3.1.6) to 3.4
April 29, 2011, 07:38:48 pm
OK. i went through the process of checking the db integrity. there was at least one deprecated table in my schema "civicrm_activity_history." but after making sure that the data was working in civicrm 3.1.4 i got the pretty much the same error as above when running the 3.4.0 upgrade script. i also tried updating to 3.1.6 (which worked) before updating to 3.4.0 and got the same error again.

Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`cirf_civicrm_development`.`civicrm_uf_field`, CONSTRAINT `FK_civicrm_uf_field_location_type_id` FOREIGN KEY (`location_type_id`) REFERENCES `civicrm_location_type` (`id`) ON DELETE SET NULL), 1452

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrading 3.1.4 (3.15, 3.1.6) to 3.4

This forum was archived on 2017-11-26.