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 »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • 4.0b3 failing to build DB schema with: DB Error: constraint violation
Pages: [1]

Author Topic: 4.0b3 failing to build DB schema with: DB Error: constraint violation  (Read 1303 times)

stefan

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
4.0b3 failing to build DB schema with: DB Error: constraint violation
April 15, 2011, 05:36:15 am
I'm running Drupal 7.0 (minimal). on apache2 under Debian Lenny. The only custom thing I've done is replicated the database using MySQL (5.0.51a-24+lenny5) master-master replication, which means that auto_increment fields are not contiguous, but I don't see any auto_increment fields used in the query below.

I've tried a fresh install twice now, both straight after a (DROP and) CREATE was issued for the CiviCRM table as entered during the configuration phase. It enters 4,276 rows across the 134 tables, but always halts at this point:

Quote
Building database schema and setup files...
Cannot execute INSERT INTO `civicrm_option_value` (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) VALUES (@option_group_id_pcm, 'Phone', 1, NULL, NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_pcm, 'Email', 2, NULL, NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_pcm, 'Postal Mail', 3, NULL, NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_pcm, 'SMS', 4, NULL, NULL, 0, NULL, 4, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_pcm, 'Fax', 5, NULL, NULL, 0, NULL, 5, NULL, 0, 0, 1, NULL, NULL), (@option_group_id_act, 'Meeting', 1, 'Meeting', NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL), etc etc
DB Error: constraint violation

Any help would be much appreciated :)

Running on: Apache/2.2.9 (Debian) mod_fastcgi/2.4.6 PHP/5.2.6-1+lenny9 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
« Last Edit: April 15, 2011, 05:48:31 am by stefan »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: 4.0b3 failing to build DB schema with: DB Error: constraint violation
April 15, 2011, 05:45:28 am
I would suggest you CREATE a fresh database and try to install CiviCRM into that. The issue appears to be related to auto-increment indexes, so a brand -new DB should fix it.
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.

stefan

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: 4.0b3 failing to build DB schema with: DB Error: constraint violation
April 15, 2011, 06:05:46 am
I've just tried installing on a fresh database for the third time with no luck.

However, the slightly different error message did confirm where the problem is
Quote
Cannot execute INSERT INTO civicrm_uf_field (id, uf_group_id, field_name, is_required, is_reserved, weight, visibility, in_selector, is_searchable, location_type_id, label, field_type, help_post, phone_type_id ) VALUES (1, 1, 'first_name', 1, 0, 1, 'Public Pages and Listings', 0, 1, NULL, 'First Name', 'Individual', NULL, NULL),

It's trying to insert an invalid auto-increment id to the server which is not allowed to do so. In a dual master-master replication setup, one server uses odd ids, the other uses even, so that if they lose sync they will never clash - see http://dev.mysql.com/doc/refman/5.0/en/replication-howto.html

Bug report CRM-7923 filed

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • 4.0b3 failing to build DB schema with: DB Error: constraint violation

This forum was archived on 2017-11-26.