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) »
  • CiviCRM DB Tools schema and civicrm.mysql don't seem to match
Pages: [1]

Author Topic: CiviCRM DB Tools schema and civicrm.mysql don't seem to match  (Read 2304 times)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
CiviCRM DB Tools schema and civicrm.mysql don't seem to match
November 15, 2009, 09:18:22 am
Hello,

I've been using dharmatech's CiviCRM DB Tools to repair an old database - really useful tool.

I started using civicrm_db_integrity.php, dealing with the errors manually.

I went from 1,000s violations to about 15, all of which were related to keys (some missing and some extra).

To solve these errors, I downloaded the civicrm.mysql for 2.2.3 and re-imported my data into that schema.

After doing that, I re-ran civicrm_db_integrity.php expecting that all the key errors would be gone, but I got the following output

Quote
CiviCRM DB Tools Version 1.2

Checking database vaw_live_civicrm
Got version 2.2.3 from civicrm_domain.version
Using schema from CiviCRM 2.2
Oops, missing key UI_source_contact_id on
    table civicrm_activity
Oops, missing key UI_activity_type_id on
    table civicrm_activity
Oops, missing key index_medium_id on
    table civicrm_activity
Oops, missing key index_is_current_revision on
    table civicrm_activity
Oops, missing key UI_original_id on
    table civicrm_activity
Oops, missing key index_is_deleted on
    table civicrm_activity
Oops, extra key FK_civicrm_activity_source_contact_id on table civicrm_activity
Oops, extra key FK_civicrm_activity_original_id on table civicrm_activity
Oops, missing key index_case_type_id on
    table civicrm_case
Oops, missing key index_is_deleted on
    table civicrm_case
10 problems found in database vaw_live_civicrm

That looked suspicious to me because I couldn't find any of the keys in the civicrm.mysql for 2.2.3.

I ran civicrm_db_repair.php and it gave this output.

Quote
CiviCRM DB Tools Version 1.2

Repairing database vaw_live_civicrm
Got version 2.2.3 from civicrm_domain.version
Using schema from CiviCRM 2.2
Dropping all foreign keys from all tables in the schema
Dropping extra key FK_civicrm_activity_source_contact_id
 from table civicrm_activity
Dropping extra key FK_civicrm_activity_original_id
 from table civicrm_activity
Repair civicrm_savedsearch here soon
Adding key UI_source_contact_id to civicrm_activity
Adding key UI_activity_type_id to civicrm_activity
Adding key index_medium_id to civicrm_activity
Adding key index_is_current_revision to civicrm_activity
Adding key UI_original_id to civicrm_activity
Adding key index_is_deleted to civicrm_activity
Adding key index_case_type_id to civicrm_case
Adding key index_is_deleted to civicrm_case
Adding foreign key constraints
Repair completed

And then again to check and I got

Quote
CiviCRM DB Tools Version 1.2

Checking database vaw_live_civicrm
Got version 2.2.3 from civicrm_domain.version
Using schema from CiviCRM 2.2
Database passed validation checks

So, to test, I downloaded civicrm.mysql civicrm_data.mysql into a new database and I got the following

Quote
CiviCRM DB Tools Version 1.2

Checking database civi_dharma_test
Got version 2.2.3 from civicrm_domain.version
Using schema from CiviCRM 2.2
Oops, no contact ID=1 exists in civicrm_contact
Oops, '2'=>'America South, Central, North and Caribbean' is missing from civicrm_worldregion
Oops, missing key UI_source_contact_id on
    table civicrm_activity
Oops, missing key UI_activity_type_id on
    table civicrm_activity
Oops, missing key index_medium_id on
    table civicrm_activity
Oops, missing key index_is_current_revision on
    table civicrm_activity
Oops, missing key UI_original_id on
    table civicrm_activity
Oops, missing key index_is_deleted on
    table civicrm_activity
Oops, extra key FK_civicrm_activity_source_contact_id on table civicrm_activity
Oops, extra key FK_civicrm_activity_original_id on table civicrm_activity
Oops, missing key index_case_type_id on
    table civicrm_case
Oops, missing key index_is_deleted on
    table civicrm_case
12 problems found in database civi_dharma_test

So perhaps all is OK.  But maybe I've got the wrong indexes on my database.  Do you have any ideas where there are these discrepencies?
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

dharmatech

  • I post frequently
  • ***
  • Posts: 280
  • Karma: 53
    • dharmatech.org
Re: CiviCRM DB Tools schema and civicrm.mysql don't seem to match
November 15, 2009, 04:24:09 pm
The DB tools check the database against the XML schema information that is supposedly used as the basis for generating civicrm.mysql, which for 2.2 is found here.  There might be a bug in the comparison code.  The specific problem identified in civicrm_worldregion is that the exact match fails because Caribbean is mispelled in civicrm_data.mysql before release 3.0.
http://dharmatech.org
oss@dharmatech.org
801.541.8671

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • CiviCRM DB Tools schema and civicrm.mysql don't seem to match

This forum was archived on 2017-11-26.