From dbb4e4f9c9e03ac2958dbad101e6bf1e0b9f19bc Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 15 Jan 2019 13:48:18 +1300 Subject: [PATCH] Remove foreign key on civicrm_acl_contact_id.user_id. This won't actually remove it from installs - we need to address that separately via ensuring people can and do run the System.updateIndices api call but it removes it from new installs and from tests, hence the test should pass --- CRM/Contact/DAO/ACLContactCache.php | 4 +--- tests/phpunit/CRM/Dedupe/MergerTest.php | 6 ++---- xml/schema/Contact/ACLContactCache.xml | 7 ------- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/CRM/Contact/DAO/ACLContactCache.php b/CRM/Contact/DAO/ACLContactCache.php index 1ea72d573b..1deee6674a 100644 --- a/CRM/Contact/DAO/ACLContactCache.php +++ b/CRM/Contact/DAO/ACLContactCache.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/ACLContactCache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:4bb9eaae5704bfc98c258aa2f2130f5c) + * (GenCodeChecksum:ab40fa26e037ef4897359d3c288d42b8) */ /** @@ -73,7 +73,6 @@ class CRM_Contact_DAO_ACLContactCache extends CRM_Core_DAO { public static function getReferenceColumns() { if (!isset(Civi::$statics[__CLASS__]['links'])) { Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); - Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'user_id', 'civicrm_contact', 'id'); Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); } @@ -108,7 +107,6 @@ class CRM_Contact_DAO_ACLContactCache extends CRM_Core_DAO { 'entity' => 'ACLContactCache', 'bao' => 'CRM_Contact_DAO_ACLContactCache', 'localizable' => 0, - 'FKClassName' => 'CRM_Contact_DAO_Contact', ], 'contact_id' => [ 'name' => 'contact_id', diff --git a/tests/phpunit/CRM/Dedupe/MergerTest.php b/tests/phpunit/CRM/Dedupe/MergerTest.php index 4ebf200baf..7f3f03435b 100644 --- a/tests/phpunit/CRM/Dedupe/MergerTest.php +++ b/tests/phpunit/CRM/Dedupe/MergerTest.php @@ -795,8 +795,7 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase { 0 => 'contact_id', ), 'civicrm_acl_contact_cache' => array( - 0 => 'user_id', - 1 => 'contact_id', + 0 => 'contact_id', ), 'civicrm_action_log' => array( 0 => 'contact_id', @@ -1002,8 +1001,7 @@ WHERE // There might be cleverer ways to do this but it shouldn't change much. $cidRefs['civicrm_contact'][0] = 'primary_contact_id'; $cidRefs['civicrm_contact'][1] = 'employer_id'; - $cidRefs['civicrm_acl_contact_cache'][0] = 'user_id'; - $cidRefs['civicrm_acl_contact_cache'][1] = 'contact_id'; + $cidRefs['civicrm_acl_contact_cache'][0] = 'contact_id'; $cidRefs['civicrm_mailing'][0] = 'created_id'; $cidRefs['civicrm_mailing'][1] = 'scheduled_id'; $cidRefs['civicrm_mailing'][2] = 'approver_id'; diff --git a/xml/schema/Contact/ACLContactCache.xml b/xml/schema/Contact/ACLContactCache.xml index d544de4050..450b56b693 100644 --- a/xml/schema/Contact/ACLContactCache.xml +++ b/xml/schema/Contact/ACLContactCache.xml @@ -25,13 +25,6 @@ FK to civicrm_contact (could be null for anon user) 3.1 - - user_id - civicrm_contact
- id - 3.1 - CASCADE -
contact_id Contact ID -- 2.25.1