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) »
  • FK constraint names not in the required format.
Pages: [1]

Author Topic: FK constraint names not in the required format.  (Read 4100 times)

iroessle

  • Guest
FK constraint names not in the required format.
March 14, 2008, 11:21:21 pm
Hello all, been working with Civicrm for sometime now... Did a lot of work with hook modules in the past, and a yet unresolved issue with hooks not working from soap calls.. atleast from 1.9..

So i'm here upgrading to 2.0.1! Excited to see this recent development.

For some reason on the upgrade, I keep on getting the following no matter how many times I build the database from civicrm_41.mysql:
----
Sorry. A non-recoverable error has occurred.

Database consistency check failed for step 3. FK constraint names not in the required format. Please rebuild your 1.9 database to ensure schema integrity.

Return to home page.
--

Any debugging tips would be welcome..  I noticed on another topic thread that there was some mention with FK's to look for but that thread was in beta5 I think..

-Ian

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: FK constraint names not in the required format.
March 15, 2008, 01:23:02 am

1. Did u report the hooks not working with soap calls issue? could not see that in your prior posts log.

2. i assume u did normalize the database as specificed in the upgrade docs (step 4), if so, can u please check the beta5 post you are referring to and your mysql tables and ensure those FK's are there

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

iroessle

  • Guest
Re: FK constraint names not in the required format.
March 15, 2008, 01:49:02 am
That was an issue atleast in 1.8 (the hooks not working within soap calls..) and the last i heard it was not scheduled to be fixed until possibly version 2.. Thats really a non issue at this point.. I'll investigate that after 2.0.1 is installed...

I have 1.9.12432 installed and haven't been able to upgrade to 2.0.1 stable. and yeah.. I tried the step 4 stuff with creating a new database importing civicrm_41.mysql and then importing either sample data or my real 1.9 data a few times to no avail. as for the beta5 post.. I did indeed check that the FK indexes that the post mentioned were in fact in the the version of the database with 1.9 that I was trying to upgrade.

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: FK constraint names not in the required format.
March 15, 2008, 10:18:54 am

You'll need to do some diagnostics and instrument the code at:

CRM/Upgrade/TwoZero/Form/Step3.php (function verifyPreDBState)

and figure out what FK constraint is failing and why.

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

iroessle

  • Guest
Re: FK constraint names not in the required format.
March 15, 2008, 02:10:54 pm
OK.. so I modded the if statement that was generating the error message too this (they were all OR'ed together in one if), so I could see which FK was throwing the error:

---------------------------------------
Code: [Select]

        if (! CRM_Core_DAO::checkFKConstraintInFormat('civicrm_address', 'county_id'))
        {
            $errorMessage = ts('Database consistency check failed for step %1 on county_id.', array(1 => '3')) . ' ' . ts('FK constraint names not in the required fo$
            return false;
        }


        if(! CRM_Core_DAO::checkFKConstraintInFormat('civicrm_address', 'state_province_id'))
        {
            $errorMessage = ts('Database consistency check failed for step %1 on state_province.', array(1 => '3')) . ' ' . ts('FK constraint names not in the requir$
            return false;
        }

        if(! CRM_Core_DAO::checkFKConstraintInFormat('civicrm_address', 'country_id'))
        {
            $errorMessage = ts('Database consistency check failed for step %1 on country_id.', array(1 => '3')) . ' ' . ts('FK constraint names not in the required f$
            return false;
        }

        if(! CRM_Core_DAO::checkFKConstraintInFormat('civicrm_event',   'payment_processor_id'))
        {
            $errorMessage = ts('Database consistency check failed for step %1 on payment_processor.', array(1 => '3')) . ' ' . ts('FK constraint names not in the req$
            return false;
        }

As it turns out it threw on the first checkFK contraint..... county_id

when I look in my database it is their however..


Here is a snippit from myphpadmin: on the table civicrm_address:
Code: [Select]
Indexes: Documentation Keyname Type Cardinality Action Field
PRIMARY PRIMARY 29484  Edit Drop id
UI_location UNIQUE 29484  Edit Drop location_id
index_street_name INDEX 29484  Edit Drop street_name
index_city INDEX 2680  Edit Drop city
FK_civicrm_address_county_id INDEX 29484  Edit Drop county_id
FK_civicrm_address_state_province_id INDEX 2106  Edit Drop state_province_id
FK_civicrm_address_country_id INDEX 29484  Edit Drop country_id
FK_civicrm_address_geo_coord_id INDEX 29484  Edit Drop geo_coord_id
Create an index on  columns

as you see there is a country ID FK.. what's gives?

I'm using mysql 5.0.44

--------

-Ian
 

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: FK constraint names not in the required format.
March 15, 2008, 02:14:53 pm

can u cut-n-paste the output of the following sql query:

show create table civicrm_address \G;

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

iroessle

  • Guest
Re: FK constraint names not in the required format.
March 15, 2008, 02:26:11 pm
Code: [Select]
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44-r1

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show create table civicrm_address \G;
*************************** 1. row ***************************
       Table: civicrm_address
Create Table: CREATE TABLE `civicrm_address` (
  `id` int(10) unsigned NOT NULL auto_increment COMMENT 'Unique Address ID',
  `location_id` int(10) unsigned NOT NULL COMMENT 'Which Location does this address belong to.',
  `street_address` varchar(96) collate utf8_unicode_ci default NULL COMMENT 'Concatenation of all routable street address components (prefix, street number, street name, suffix, unit number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail delivery, etc.).',
  `street_number` int(11) default NULL COMMENT 'Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.',
  `street_number_suffix` varchar(8) collate utf8_unicode_ci default NULL COMMENT 'Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A',
  `street_number_predirectional` varchar(8) collate utf8_unicode_ci default NULL COMMENT 'Directional prefix, e.g. SE Main St, SE is the prefix.',
  `street_name` varchar(64) collate utf8_unicode_ci default NULL COMMENT 'Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main.',
  `street_type` varchar(8) collate utf8_unicode_ci default NULL COMMENT 'St, Rd, Dr, etc.',
  `street_number_postdirectional` varchar(8) collate utf8_unicode_ci default NULL COMMENT 'Directional prefix, e.g. Main St S, S is the suffix.',
  `street_unit` varchar(16) collate utf8_unicode_ci default NULL COMMENT 'Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200',
  `supplemental_address_1` varchar(96) collate utf8_unicode_ci default NULL COMMENT 'Supplemental Address Information, Line 1',
  `supplemental_address_2` varchar(96) collate utf8_unicode_ci default NULL COMMENT 'Supplemental Address Information, Line 2',
  `supplemental_address_3` varchar(96) collate utf8_unicode_ci default NULL COMMENT 'Supplemental Address Information, Line 3',
  `city` varchar(64) collate utf8_unicode_ci default NULL COMMENT 'City, Town or Village Name.',
  `county_id` int(10) unsigned default NULL COMMENT 'Which County does this address belong to.',
  `state_province_id` int(10) unsigned default NULL COMMENT 'Which State_Province does this address belong to.',
  `postal_code_suffix` varchar(12) collate utf8_unicode_ci default NULL COMMENT 'Store the suffix, like the +4 part in the USPS system.',
  `postal_code` varchar(12) collate utf8_unicode_ci default NULL COMMENT 'Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.',
  `usps_adc` varchar(32) collate utf8_unicode_ci default NULL COMMENT 'USPS Bulk mailing code.',
  `country_id` int(10) unsigned default NULL COMMENT 'Which Country does this address belong to.',
  `geo_coord_id` int(10) unsigned default NULL COMMENT 'Which Geo_Coord does this address belong to.',
  `geo_code_1` double default NULL COMMENT 'Latitude or UTM (Universal Transverse Mercator Grid) Northing.',
  `geo_code_2` double default NULL COMMENT 'Longitude or UTM (Universal Transverse Mercator Grid) Easting.',
  `timezone` varchar(8) collate utf8_unicode_ci default NULL COMMENT 'Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".',
  `note` varchar(255) collate utf8_unicode_ci default NULL COMMENT 'Optional misc info (e.g. delivery instructions) for this address.',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `UI_location` (`location_id`),
  KEY `index_street_name` (`street_name`),
  KEY `index_city` (`city`),
  KEY `FK_civicrm_address_county_id` (`county_id`),
  KEY `FK_civicrm_address_state_province_id` (`state_province_id`),
  KEY `FK_civicrm_address_country_id` (`country_id`),
  KEY `FK_civicrm_address_geo_coord_id` (`geo_coord_id`)
) ENGINE=MyISAM AUTO_INCREMENT=33213 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
1 row in set (0.00 sec)

ERROR:
No query specified

mysql>

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: FK constraint names not in the required format.
March 15, 2008, 06:21:42 pm

check the last line of your the below output. You are using MyISAM. CiviCRM requires InnoDB

) ENGINE=MyISAM AUTO_INCREMENT=33213 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

Constraints are a InnoDB feature

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

iroessle

  • Guest
Re: FK constraint names not in the required format.
March 15, 2008, 07:41:42 pm
took a little while to get InnoDB up.. but it works now.. thanks...  how do I karma +1 you?


-Ian

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: FK constraint names not in the required format.
March 17, 2008, 12:03:30 am
lobo has too many Karma's :P, still if you want to add more, click on "applaud"  :)

kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • FK constraint names not in the required format.

This forum was archived on 2017-11-26.