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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Database Errors on Upgrade
Pages: [1]

Author Topic: Database Errors on Upgrade  (Read 1142 times)

general_ludd

  • I’m new here
  • *
  • Posts: 24
  • Karma: 1
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.62-0ubuntu0.10.04.1
  • PHP version: PHP Version 5.3.2-1ubuntu4.14
Database Errors on Upgrade
April 27, 2012, 02:47:14 pm
I am having a devil of a time with an upgrade to the latest version of Civi (4.08 to 4.10). When I try to run the upgrade script (after doing all the appropriate steps on the upgrade page), the site tells me that a number of tables in the database already exist. When I remove each table, it comes up with a new one until I come to a table that has foreign-key constraints and cannot be dropped. Why would the upgrade script try to create tables that already exist?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Database Errors on Upgrade
April 27, 2012, 03:26:14 pm
In general this problem happens when a database upgrade has failed part-ways through - and then the upgrade is run again w/o reverting the database to a clean backup of the pre-upgrade state. (Also, hopefully you are using the latest stable version to upgrade TO - 4.1.2.)
Protect your investment in CiviCRM by  becoming a Member!

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Database Errors on Upgrade
April 28, 2012, 05:22:59 pm
Quote from: general_ludd on April 27, 2012, 02:47:14 pm
Why would the upgrade script try to create tables that already exist?

It does not. It tries to create tables that do NOT exist in the older version. As Dave said, this error almost always means that some upgrade was only partially executed and so those tables were created. If you don't have a full backup of your site from before, then you can try to remove those tables. You can also set MySQL to ignore foreign key constraints and thereby forcibly remove them.

But be warned that you may then get other errors about fields already existing that shouldn't. But anyway you can try to remove the tables and see what happens.
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.

general_ludd

  • I’m new here
  • *
  • Posts: 24
  • Karma: 1
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.62-0ubuntu0.10.04.1
  • PHP version: PHP Version 5.3.2-1ubuntu4.14
Re: Database Errors on Upgrade
April 30, 2012, 11:41:20 am
Is there a list of table differences between version 4.08 and 4.10?

general_ludd

  • I’m new here
  • *
  • Posts: 24
  • Karma: 1
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.62-0ubuntu0.10.04.1
  • PHP version: PHP Version 5.3.2-1ubuntu4.14
Re: Database Errors on Upgrade
May 01, 2012, 02:01:05 pm
I finally fixed the database problems, and was able to upgrade without complaint as far as the immediate upgrade process was concerned. When I tried to go to the home page, however, I got the following very unhappy error:
Fatal error: require_once(): Failed opening required '[site_root]/sites/default/modules/civicrm/drupal/modules/views/civicrm/civicrm_handler_filter_event_type.inc' (include_path='.:[site_root]/sites/default/modules/civicrm/:[server_path]/sites/default/modules/civicrm//packages:.:/usr/share/php:/usr/share/pear') in [site_root]/includes/bootstrap.inc on line 3024

Any suggestions?

general_ludd

  • I’m new here
  • *
  • Posts: 24
  • Karma: 1
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.62-0ubuntu0.10.04.1
  • PHP version: PHP Version 5.3.2-1ubuntu4.14
Re: Database Errors on Upgrade
May 01, 2012, 02:22:09 pm
Solved. Thank goodness for Drush! I used drush cc all to clear the caches and everything went happy!

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Database Errors on Upgrade
May 02, 2012, 09:21:30 am
Good to know. Can you scan the 4.1 upgrade doc and see if there's a good spot to add a tip about using cc if you see certain errors.
Protect your investment in CiviCRM by  becoming a Member!

general_ludd

  • I’m new here
  • *
  • Posts: 24
  • Karma: 1
  • CiviCRM version: 4.1.0
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.62-0ubuntu0.10.04.1
  • PHP version: PHP Version 5.3.2-1ubuntu4.14
Re: Database Errors on Upgrade
May 02, 2012, 12:35:43 pm
By the way, the database deletion script I used that might be useful for others is as follows (cleaning up after the result of previous failed upgrade):

DROP TABLE `civicrm_setting`;
DROP TABLE `civicrm_job`;
DROP TABLE `civicrm_job_log`;
ALTER TABLE `civicrm_event_carts` DROP FOREIGN KEY FK_civicrm_event_carts_user_id;
ALTER TABLE `civicrm_events_in_carts` DROP FOREIGN KEY FK_civicrm_events_in_carts_event_id;
ALTER TABLE `civicrm_events_in_carts` DROP FOREIGN KEY FK_civicrm_events_in_carts_event_cart_id;
DROP TABLE `civicrm_event_carts`;
DROP TABLE `civicrm_events_in_carts`;

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Database Errors on Upgrade

This forum was archived on 2017-11-26.