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) »
  • Upgarde 1.9 -> 2.05, Orphaned civicrm_contribution_page
Pages: [1]

Author Topic: Upgarde 1.9 -> 2.05, Orphaned civicrm_contribution_page  (Read 1312 times)

jlhurd

  • Guest
Upgarde 1.9 -> 2.05, Orphaned civicrm_contribution_page
August 07, 2008, 11:45:21 am
I am upgrading from 1.9 (which was originally 1.8 ) to 2.05.  I have followed the outlined upgrade instructions methodically, and rebuilt the 1.9 database to ensure integrity.  However, on step six I get the following error:

ALTER TABLE `civicrm_contribution_page` ADD CONSTRAINT `FK_civicrm_contribution_page_payment_processor_id` FOREIGN KEY (`payment_processor_id`) REFERENCES `civicrm_payment_processor` (`id`) ON DELETE SET NULL [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`wcpr_civicrm19Fix/#sql-6e4_be2e4`, CONSTRAINT `FK_civicrm_contribution_page_payment_processor_id` FOREIGN KEY (`payment_processor_id`) REFERENCES `civicrm_payment_processor` (`id`) ON DELETE )]

Based on pouring through other similar problems that other people have had, I know that something in civicrm_contribution_page is orphaned.  It seems like doing a DELETE and LEFT JOIN command, like for the other cleanups, would fix this, but I am not all that proficient with SQL, and would appreciate some help getting the correct command.

Thanks,

Josh

Deepak Srivastava

  • Moderator
  • Ask me questions
  • *****
  • Posts: 677
  • Karma: 65
Re: Upgarde 1.9 -> 2.05, Orphaned civicrm_contribution_page
August 08, 2008, 12:35:42 am
Use this command -
Code: [Select]
UPDATE civicrm_contribution_page cp
LEFT JOIN civicrm_payment_processor pp ON cp.payment_processor_id = pp.id
SET cp.payment_processor_id=NULL
WHERE pp.id IS NULL;
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

jlhurd

  • Guest
Re: Upgarde 1.9 -> 2.05, Orphaned civicrm_contribution_page
August 10, 2008, 09:57:37 pm
Thanks for the help.  That snippet seemed to have fixed the first problem, but now upon running step six I get this problem:

    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => ALTER TABLE `civicrm_mailing`
    ADD CONSTRAINT `FK_civicrm_mailing_footer_id` FOREIGN KEY (`footer_id`) REFERENCES `civicrm_mailing_component` (`id`) ON DELETE SET NULL,
    ADD CONSTRAINT `FK_civicrm_mailing_header_id` FOREIGN KEY (`header_id`) REFERENCES `civicrm_mailing_component` (`id`) ON DELETE SET NULL,
    ADD CONSTRAINT `FK_civicrm_mailing_msg_template_id` FOREIGN KEY (`msg_template_id`) REFERENCES `civicrm_msg_template` (`id`) ON DELETE SET NULL,
    ADD CONSTRAINT `FK_civicrm_mailing_optout_id` FOREIGN KEY (`optout_id`) REFERENCES `civicrm_mailing_component` (`id`) ON DELETE SET NULL,
    ADD CONSTRAINT `FK_civicrm_mailing_reply_id` FOREIGN KEY (`reply_id`) REFERENCES `civicrm_mailing_component` (`id`) ON DELETE SET NULL,
    ADD CONSTRAINT `FK_civicrm_mailing_unsubscribe_id` FOREIGN KEY (`unsubscribe_id`) REFERENCES `civicrm_mailing_component` (`id`) ON DELETE SET NULL [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`wcpr_civicrm19Fix/#sql-6e4_d36c3`, CONSTRAINT `FK_civicrm_mailing_optout_id` FOREIGN KEY (`optout_id`) REFERENCES `civicrm_mailing_component` (`id`) ON DELETE SET NULL)]

Any ideas?  I followed the upgrade instructions thoroughly, and I know that my database's schema is correct.

Thanks!

Deepak Srivastava

  • Moderator
  • Ask me questions
  • *****
  • Posts: 677
  • Karma: 65
Re: Upgarde 1.9 -> 2.05, Orphaned civicrm_contribution_page
August 10, 2008, 10:17:54 pm
Quote
a foreign key constraint fails (`wcpr_civicrm19Fix/#sql-6e4_d36c3`, CONSTRAINT `FK_civicrm_mailing_optout_id` FOREIGN KEY (`optout_id`) REFERENCES `civicrm_mailing_component` (`id`) ON DELETE SET NULL)]

Error shows the problem is with optout_id, so the query would be:

Code: [Select]
UPDATE civicrm_mailing cm
LEFT JOIN civicrm_mailing_component cmc ON cm.optout_id = cmc.id
SET cm.optout_id=NULL
WHERE cmc.id IS NULL;

Repeat for other fields of the same table (civicrm_mailing) if required.
« Last Edit: August 10, 2008, 10:20:07 pm by Deepak Srivastava »
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgarde 1.9 -> 2.05, Orphaned civicrm_contribution_page

This forum was archived on 2017-11-26.