Dave,
looking at my v.2.0 tables I don't have the following keys
civicrm_activity FK_civicrm_activity_activity_type_id
civicrm_case FK_civicrm_case_status_id
but do have
civicrm_activity UI_activity_type_id
civicrm_case UI_status_id
A bit of investigation shows that the beta 2 distro has
civicrm.mysql file would create these keys:
CREATE TABLE civicrm_activity ......
PRIMARY KEY ( id ),
INDEX UI_source_contact_id(source_contact_id),
INDEX UI_activity_type_id(activity_type_id),
CONSTRAINT FK_civicrm_activity_source_contact_id FOREIGN KEY (source_contact_id) REFERENCES civicrm_contact(id) ON DELETE CASCADE,
CONSTRAINT FK_civicrm_activity_activity_type_id FOREIGN KEY (activity_type_id) REFERENCES civicrm_option_value(id) ,
CONSTRAINT FK_civicrm_activity_phone_id FOREIGN KEY (phone_id) REFERENCES civicrm_phone(id) ON DELETE SET NULL,
CONSTRAINT FK_civicrm_activity_status_id FOREIGN KEY (status_id) REFERENCES civicrm_option_value(id) ON DELETE SET NULL,
CONSTRAINT FK_civicrm_activity_priority_id FOREIGN KEY (priority_id) REFERENCES civicrm_option_value(id) ON DELETE SET NULL,
CONSTRAINT FK_civicrm_activity_parent_id FOREIGN KEY (parent_id) REFERENCES civicrm_activity(id) ON DELETE CASCADE
CREATE TABLE civicrm_case .....
PRIMARY KEY ( id ),
INDEX index_case_type_id(case_type_id),
INDEX UI_status_id(status_id),
CONSTRAINT FK_civicrm_case_contact_id FOREIGN KEY (contact_id) REFERENCES civicrm_contact(id) ON DELETE CASCADE,
CONSTRAINT FK_civicrm_case_status_id FOREIGN KEY (status_id) REFERENCES civicrm_option_value(id)
civicrm_activity FK_civicrm_activity_activity_type_id doesn't exist in a new 1.9 install, so it looked like the upgrade process didn't create all the keys:
Upgrade/TwoZero/sql/activity.mysql
ALTER TABLE `civicrm_activity`…
ADD INDEX `UI_source_contact_id` (`source_contact_id`),
DROP FOREIGN KEY FK_civicrm_activity_source_contact_id,
DROP FOREIGN KEY FK_civicrm_activity_parent_id;
ALTER TABLE `civicrm_activity`
ADD CONSTRAINT `FK_civicrm_activity_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `FK_civicrm_activity_phone_id` FOREIGN KEY (`phone_id`) REFERENCES `civicrm_phone` (`id`) ON DELETE SET NULL,
ADD CONSTRAINT `FK_civicrm_activity_source_contact_id` FOREIGN KEY (`source_contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE;
civicrm_case didn't exist in 1.9 so was created during the upgrade.
Upgrade/TwoZero/sql/others.mysql
CREATE TABLE IF NOT EXISTS `civicrm_case` (
.....
PRIMARY KEY (id),
INDEX `index_case_type_id` (`case_type_id`),
INDEX `UI_status_id` (`status_id`),
CONSTRAINT `FK_civicrm_case_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE,
CONSTRAINT `FK_civicrm_case_status_id` FOREIGN KEY (`status_id`) REFERENCES `civicrm_option_value` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
This indicates that the civicrm_case FK_civicrm_case_status_id should have been created but neither my offline upgraded db or my test db show that key. don't understand that one.
Before upgrading I went though the normalisation process for my 1.9 db so it should be a clean upgrade from 1.9. When's beta 3 out? Might be easier to just process my 1.9 db again.