Remove foreign key on civicrm_acl_contact_id.user_id.
authoreileen <emcnaughton@wikimedia.org>
Tue, 15 Jan 2019 00:48:18 +0000 (13:48 +1300)
committereileen <emcnaughton@wikimedia.org>
Tue, 15 Jan 2019 08:30:58 +0000 (21:30 +1300)
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
tests/phpunit/CRM/Dedupe/MergerTest.php
xml/schema/Contact/ACLContactCache.xml

index 1ea72d573b9e9842c4e2654901fd14367ff5bacb..1deee6674ac7d6edfa46553e724808da62b5e2ec 100644 (file)
@@ -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',
index 4ebf200baf77877dd49c826c43e4f3b06e24b918..7f3f03435bdb28f4edbfced94bbe78d314a68f1d 100644 (file)
@@ -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';
index d544de405067fefcaf75127d2decc823ecdcc0b1..450b56b693eb55c5be3b28f3a4db65efbf388f95 100644 (file)
     <comment>FK to civicrm_contact (could be null for anon user)</comment>
     <add>3.1</add>
   </field>
-  <foreignKey>
-    <name>user_id</name>
-    <table>civicrm_contact</table>
-    <key>id</key>
-    <add>3.1</add>
-    <onDelete>CASCADE</onDelete>
-  </foreignKey>
   <field>
     <name>contact_id</name>
     <title>Contact ID</title>