Answers.Body: <p>If I understand correctly, you first installed 4.6.0 and then loaded a DB dump for 4.3.4 on top of the 4.6.0 system. Doing so would put the database in an inconsistent state &#8212; some elements from 4.6.0 (e.g. the table <code>civicrm_mailing_abtest</code>) are still present, but other elements are replaced by the 4.3.4 version (e.g. the table <code>civicrm_domain</code>).</p>
  
  <p>When loading an old database dump, ensure that you are loading into a pristine database. The easiest way is to drop+recreate the database before loading.</p>
  
  <p>If for some reason that's not possible (eg the database is shared with another app whose data must be preserved), then you might drop all <code>civicrm_*</code> tables (and preserve the other tables). The exact steps will depend on your tooling. I can't speak about any GUI tools, but if you're comfortable with scripting, then you could ripoff this snippet from <a href="https://github.com/civicrm/civicrm-core/blob/4.6/bin/setup.sh#L191" rel="nofollow">setup.sh</a>.</p>
  
  <pre><code>echo; echo "Dropping civicrm_* tables from database $DBNAME"
  echo "SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA='${DBNAME}' AND TABLE_TYPE = 'VIEW'" \
      | $MYSQLCMD \
      | grep '^\(civicrm_\|log_civicrm_\)' \
      | awk -v NOFOREIGNCHECK='SET FOREIGN_KEY_CHECKS=0;' 'BEGIN {print NOFOREIGNCHECK}{print "drop view " $1 ";"}' \
      | $MYSQLCMD
  echo "SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA='${DBNAME}' AND TABLE_TYPE = 'BASE TABLE'" \
      | $MYSQLCMD \
      | grep '^\(civicrm_\|log_civicrm_\)' \
      | awk -v NOFOREIGNCHECK='SET FOREIGN_KEY_CHECKS=0;' 'BEGIN {print NOFOREIGNCHECK}{print "drop table " $1 ";"}' \
      | $MYSQLCMD
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-05T09:22:24.190Z
Answers.LastActivityDate: 2015-04-06T16:09:54.243Z
Answers.LastEditDate: 2015-04-06T16:09:54.243Z
Answers.UserDisplayName: Tim Otten
Answers.Body: <p>Try importing the "drop everything" file from the CiviCRM tarball in <code>sql/civicrm_drop.mysql</code> to remove all 4.6.0 tables from your new database. Then re-import your 4.3.4 database. Then try the upgrade. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-14T04:40:28.397Z
Answers.Text: note that civicrm_drop,mysql is not complete since it does not include any custom tables that have been created (from custom groups/fields)
Answers.UserDisplayName: Donald Lobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-05T20:32:10.367Z
Answers.Text: Based on your error message: "Duplicate column name 'created_id'" this sounds like a reasonable approach.
Answers.UserDisplayName: DaveD
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-07T00:01:10.260Z
Answers.Text: Thanks but when I ran the upgrade script, I got no upgrade screen. ?<mysitename>q=civicrm/upgrade&reset=1
Answers.UserDisplayName: Vietyank
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-05T13:47:33.087Z
Answers.LastActivityDate: 2015-04-05T13:47:33.087Z
Answers.UserDisplayName: LunkRat
Body: <p>I loaded a new 4.6.0 database with data dumped from a 4.3.4 database. The update ran okay to a certain point, when I got this message:</p>
  
  <pre><code>*[Error: Upgrade DB to 4.6.alpha7]
  Error Field Error Value
  Type    DB_Error
  Code    -1
  Message DB Error: unknown error
  Mode    16
  UserInfo    ALTER TABLE civicrm_mailing_abtest ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', ADD COLUMN `created_date` datetime COMMENT 'When was this item created', ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL [nativecode=1060 ** Duplicate column name 'created_id']
  DebugInfo   ALTER TABLE civicrm_mailing_abtest ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', ADD COLUMN `created_date` datetime COMMENT 'When was this item created', ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL [nativecode=1060 ** Duplicate column name 'created_id']
  PEAR_Exception: DB Error: unknown error in unknown on line unknown
  - DB_Error: DB Error: unknown error in unknown on line unknown*
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-01-05T06:40:06.263Z
Comments.Text: I had a similar issue, almost exactly the same. I had been upgrading from a very old version with repeated failures until I went slowly. I suspect the mailing_abtest snuck in there. I just dropped the civicrm_mailing_abtest table, and it breezed by the 4.6.alpha7 step.
Comments.UserDisplayName: Harold Shinsato
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-13T03:00:24.807Z
Comments.Text: How can an issue be closed? I have completed this successfully.
Comments.UserDisplayName: Vietyank
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-13T23:01:19.953Z
Comments.Text: Questions on StackExchange do not have an open or closed status. The most useful thing you could do to resolve this would be to post an answer saying how you solved the problem, then mark it as the accepted answer.
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-07T00:27:41.797Z
Comments.Text: You'll get better answers if you give more details. Can you list exactly what steps you took, on what server, with which cms, and which version of php, mysql, etc.
Comments.UserDisplayName: Coleman
Tags: <database><upgrade><4.6.0>
Title: What to do when upgrading from 4.3.4 to 4.6.0 is failing?
ThreadText: # What to do when upgrading from 4.3.4 to 4.6.0 is failing?
  
  (Asked by: username_0 on 2015-04-05)
  
  I loaded a new 4.6.0 database with data dumped from a 4.3.4 database. The update ran okay to a certain point, when I got this message:
  *[Error: Upgrade DB to 4.6.alpha7]
  Error Field Error Value
  Type    DB_Error
  Code    -1
  Message DB Error: unknown error
  Mode    16
  UserInfo    ALTER TABLE civicrm_mailing_abtest ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', ADD COLUMN `created_date` datetime COMMENT 'When was this item created', ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL [nativecode=1060 ** Duplicate column name 'created_id']
  DebugInfo   ALTER TABLE civicrm_mailing_abtest ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID', ADD COLUMN `created_date` datetime COMMENT 'When was this item created', ADD COLUMN `testing_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD COLUMN `winner_criteria` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL [nativecode=1060 ** Duplicate column name 'created_id']
  PEAR_Exception: DB Error: unknown error in unknown on line unknown
  - DB_Error: DB Error: unknown error in unknown on line unknown*
  
  **Tags:** database, upgrade, 4.6.0
  
  > **Comments:**
  > **username_2**: You'll get better answers if you give more details. Can you list exactly what steps you took, on what server, with which cms, and which version of php, mysql, etc.  
  > **username_0**: How can an issue be closed? I have completed this successfully.  
  > **username_2**: Questions on StackExchange do not have an open or closed status. The most useful thing you could do to resolve this would be to post an answer saying how you solved the problem, then mark it as the accepted answer.  
  > **username_1**: I had a similar issue, almost exactly the same. I had been upgrading from a very old version with repeated failures until I went slowly. I suspect the mailing_abtest snuck in there. I just dropped the civicrm_mailing_abtest table, and it breezed by the 4.6.alpha7 step.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2015-04-05. Score: 5
  
  If I understand correctly, you first installed 4.6.0 and then loaded a DB dump for 4.3.4 on top of the 4.6.0 system. Doing so would put the database in an inconsistent state — some elements from 4.6.0 (e.g. the table civicrm_mailing_abtest) are still present, but other elements are replaced by the 4.3.4 version (e.g. the table civicrm_domain).
  When loading an old database dump, ensure that you are loading into a pristine database. The easiest way is to drop+recreate the database before loading.
  If for some reason that's not possible (eg the database is shared with another app whose data must be preserved), then you might drop all civicrm_* tables (and preserve the other tables). The exact steps will depend on your tooling. I can't speak about any GUI tools, but if you're comfortable with scripting, then you could ripoff this snippet from setup.sh.
  echo; echo "Dropping civicrm_* tables from database $DBNAME"
  echo "SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA='${DBNAME}' AND TABLE_TYPE = 'VIEW'" \
      | $MYSQLCMD \
      | grep '^\(civicrm_\|log_civicrm_\)' \
      | awk -v NOFOREIGNCHECK='SET FOREIGN_KEY_CHECKS=0;' 'BEGIN {print NOFOREIGNCHECK}{print "drop view " $1 ";"}' \
      | $MYSQLCMD
  echo "SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA='${DBNAME}' AND TABLE_TYPE = 'BASE TABLE'" \
      | $MYSQLCMD \
      | grep '^\(civicrm_\|log_civicrm_\)' \
      | awk -v NOFOREIGNCHECK='SET FOREIGN_KEY_CHECKS=0;' 'BEGIN {print NOFOREIGNCHECK}{print "drop table " $1 ";"}' \
      | $MYSQLCMD
  
  
  ---
  
  ### Answer by username_4 on 2015-04-05. Score: 3
  
  Try importing the "drop everything" file from the CiviCRM tarball in `sql/civicrm_drop.mysql` to remove all 4.6.0 tables from your new database. Then re-import your 4.3.4 database. Then try the upgrade.
  
  > **Comments:**
  > **username_6**: Based on your error message: "Duplicate column name 'created_id'" this sounds like a reasonable approach.  
  > **username_0**: Thanks but when I ran the upgrade script, I got no upgrade screen. ?<mysitename>q=civicrm/upgrade&reset=1  
  > **username_5**: note that civicrm_drop,mysql is not complete since it does not include any custom tables that have been created (from custom groups/fields)  
  
  ---
  
  