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) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 2.1 Release Testing »
  • Upgrade error from 2.0 to 2.1
Pages: [1]

Author Topic: Upgrade error from 2.0 to 2.1  (Read 2762 times)

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Upgrade error from 2.0 to 2.1
August 15, 2008, 02:00:57 pm
Just upgraded from 1.9 and all seemed well.
I ran the longer upgrade process to make sure 1.9 was fine. Then ran the 2.0 upgrade in the browser and that worked well.
The site was working fine.
Then I upgrade to 2.1 (we need pledges)
First I got this error
Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -4
    [message] => DB Error: not found
    [mode] => 16
    [debug_info] => ALTER TABLE `civicrm_group_contact`
    DROP FOREIGN KEY `FK_civicrm_group_contact_location_id`,
    DROP location_id [nativecode=1091 ** Can't DROP 'location_id'; check that column/key exists]
    [type] => DB_Error
    [user_info] => ALTER TABLE `civicrm_group_contact`
    DROP FOREIGN KEY `FK_civicrm_group_contact_location_id`,
    DROP location_id [nativecode=1091 ** Can't DROP 'location_id'; check that column/key exists]
    [to_string] => [db_error: message="DB Error: not found" code=-4 mode=callback callback=CRM_Core_Error::handle prefix="" info="ALTER TABLE `civicrm_group_contact`
    DROP FOREIGN KEY `FK_civicrm_group_contact_location_id`,
    DROP location_id [nativecode=1091 ** Can't DROP 'location_id'; check that column/key exists]"]
)
-------------------
I ran
Code: [Select]
ALTER TABLE `civicrm_group_contact` ADD `location_id` INT UNSIGNED NOT NULL COMMENT 'Optional location to associate with this membership' AFTER `status` ;
to see if I could cheat my way past this error but then got the error below....


Then ----
Error Details:
Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => ALTER TABLE `civicrm_group_contact`
    DROP FOREIGN KEY `FK_civicrm_group_contact_location_id`,
    DROP location_id [nativecode=1025 ** Error on rename of './civicrm19Fix/civicrm_group_contact' to './civicrm19Fix/#sql2-1581-613' (errno: 152)]
    [type] => DB_Error
    [user_info] => ALTER TABLE `civicrm_group_contact`
    DROP FOREIGN KEY `FK_civicrm_group_contact_location_id`,
    DROP location_id [nativecode=1025 ** Error on rename of './civicrm19Fix/civicrm_group_contact' to './civicrm19Fix/#sql2-1581-613' (errno: 152)]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="ALTER TABLE `civicrm_group_contact`
    DROP FOREIGN KEY `FK_civicrm_group_contact_location_id`,
-------------------------------------------------------end error
Any thoughts?
I will try again later.
Server version: 5.0.51a-3ubuntu5.2
PHP Version 5.2.4-2ubuntu5.3
??
Thanks
   [/code][/code]

Deepak Srivastava

  • Ask me questions
  • ****
  • Posts: 677
  • Karma: 65
Re: Upgrade error from 2.0 to 2.1
August 16, 2008, 08:06:55 am
To properly cheat you 'll also need to add the foreign key -
Code: [Select]
ALTER TABLE `civicrm_group_contact`
 ADD `location_id` int(10) unsigned default NULL COMMENT 'Optional location to associate with this membership', 
 ADD CONSTRAINT `FK_civicrm_group_contact_location_id` FOREIGN KEY (`location_id`) REFERENCES `civicrm_loc_block` (`id`) ON DELETE SET NULL;

However the question - 'why this field wasn't present in your db' still remains. Any idea ?
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: Upgrade error from 2.0 to 2.1
August 16, 2008, 09:01:47 am
Right, how did I run the civicrm19Fix from 1.9 to 2.0 then that worked great.
Then tested a bunch of contacts etc.
But then ran this and got the error.
I will try your suggestion. I am looking over the upgrade scripts and seeing what else I am missing.
Thanks

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: Upgrade error from 2.0 to 2.1
August 16, 2008, 09:12:01 am
Ooops tried and got this error in phpmyadmin
Code: [Select]
SQL query:

ALTER TABLE `civicrm_group_contact` ADD CONSTRAINT `FK_civicrm_group_contact_location_id` FOREIGN KEY ( `location_id` ) REFERENCES `civicrm_loc_block` ( `id` ) ON DELETE SET NULL

MySQL said: Documentation
#1005 - Can't create table './civicrm19Fix/#sql-74ee_27.frm' (errno: 150)
 

Deepak Srivastava

  • Ask me questions
  • ****
  • Posts: 677
  • Karma: 65
Re: Upgrade error from 2.0 to 2.1
August 16, 2008, 11:07:33 am
This is because when adding the column 'location_id' for the first time you made it "NOT NULL". And when you add FK constraint, since you not providing any values results in that error.
So first drop the column location_id and add it again (or modify) allowing it to have null values (use the query i pasted ).
« Last Edit: August 16, 2008, 11:12:14 am by Deepak Srivastava »
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: Upgrade error from 2.0 to 2.1
August 18, 2008, 07:08:17 am
Worked perfect after that.
Thanks!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 2.1 Release Testing »
  • Upgrade error from 2.0 to 2.1

This forum was archived on 2017-11-26.