Remove campaign_id pseudoconstants
authorColeman Watts <coleman@civicrm.org>
Sat, 30 Jan 2021 00:28:06 +0000 (19:28 -0500)
committerColeman Watts <coleman@civicrm.org>
Thu, 4 Feb 2021 19:46:29 +0000 (14:46 -0500)
Pseudoconstants are intended for option lists small enough to be loaded into memory,
whereas FKs are for options of any size.
It is possible to have thousands of campaigns, and some sites do,
which slows or breaks some UIs (first noticed in the Search Kit bulk update action).

All these fields have both an FK and a pseudoconstant declared, which is redundant;
both are not needed, and the pseudoconstant was unnecessarily hogging memory for sites with many campaigns.

22 files changed:
CRM/Activity/DAO/Activity.php
CRM/Campaign/DAO/CampaignGroup.php
CRM/Campaign/DAO/Survey.php
CRM/Contribute/DAO/Contribution.php
CRM/Contribute/DAO/ContributionPage.php
CRM/Contribute/DAO/ContributionRecur.php
CRM/Event/DAO/Event.php
CRM/Event/DAO/Participant.php
CRM/Mailing/DAO/Mailing.php
CRM/Member/DAO/Membership.php
CRM/Pledge/DAO/Pledge.php
xml/schema/Activity/Activity.xml
xml/schema/Campaign/CampaignGroup.xml
xml/schema/Campaign/Survey.xml
xml/schema/Contribute/Contribution.xml
xml/schema/Contribute/ContributionPage.xml
xml/schema/Contribute/ContributionRecur.xml
xml/schema/Event/Event.xml
xml/schema/Event/Participant.xml
xml/schema/Mailing/Mailing.xml
xml/schema/Member/Membership.xml
xml/schema/Pledge/Pledge.xml

index 6d764364cbc5e092870b21b28923cc9c0f09469a..e1acd532bc8bc344b44aca1a5dd53f919e8b991c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Activity/Activity.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:20d5b91c29b14f4df12aabfc07c58e94)
+ * (GenCodeChecksum:e40c263d7d030dc0c6d6e714317a3970)
  */
 
 /**
@@ -659,11 +659,6 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO {
           'html' => [
             'type' => 'Select',
           ],
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.4',
         ],
         'activity_engagement_level' => [
index a448bd16fb0800e7edf0dcafd4bcf5262477cabe..96863381a859279113f1334f9a7bed7eb33fb1a2 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Campaign/CampaignGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:88f73bc59595d75977b66fe76466a22c)
+ * (GenCodeChecksum:a10a2acb5e6198e023bf1b97883b16cf)
  */
 
 /**
@@ -133,11 +133,6 @@ class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO {
           'bao' => 'CRM_Campaign_DAO_CampaignGroup',
           'localizable' => 0,
           'FKClassName' => 'CRM_Campaign_DAO_Campaign',
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.3',
         ],
         'group_type' => [
index aa303547eef399a0bdccff826d5718722ed57130..72c34066480129c054af232ef3fd83a1f97c4cc7 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Campaign/Survey.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:03edb270b63048ec3aa9f36667548961)
+ * (GenCodeChecksum:8a55f06388a594dd78f397320b1b55a6)
  */
 
 /**
@@ -270,11 +270,6 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
           'bao' => 'CRM_Campaign_BAO_Survey',
           'localizable' => 0,
           'FKClassName' => 'CRM_Campaign_DAO_Campaign',
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.3',
         ],
         'activity_type_id' => [
index e9936e8cf2eb5b23dcca25ab20177a30d64d8c2e..b8c6b0a03c04224b87f8c776d292ecd9f1480d20 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/Contribution.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:11b9f8bc6198e4338be2406de58b6723)
+ * (GenCodeChecksum:66fa0e83ae7eb57a3c2e515c8fdc371c)
  */
 
 /**
@@ -843,11 +843,6 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
           'html' => [
             'type' => 'Select',
           ],
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.4',
         ],
         'creditnote_id' => [
index e38ebbf9fe1faf59bc7b4fdd5ff2a03a3357df8d..adc5656538a1e66d38f207f99257e94f4165c937 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionPage.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:958ef76562a951e9f80b8e6f16afd6ee)
+ * (GenCodeChecksum:a8f42298c3fbe5b8c1986c81d77a8a0f)
  */
 
 /**
@@ -1033,11 +1033,6 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
           'bao' => 'CRM_Contribute_BAO_ContributionPage',
           'localizable' => 0,
           'FKClassName' => 'CRM_Campaign_DAO_Campaign',
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.4',
         ],
         'is_share' => [
index 9bed9fd903ad8e0e2552c37b7d2e65fcbb3dcffb..08f922a170a924e39d970b8a550ba7ab2a98b06a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5e2fa2241a3f8c014352d897be31fad1)
+ * (GenCodeChecksum:69bfc032333f519d938978caf8d9d7ec)
  */
 
 /**
@@ -771,11 +771,6 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
           'html' => [
             'type' => 'Select',
           ],
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '4.1',
         ],
         'is_email_receipt' => [
index ea4305c1da9e8dc10865f74a58e4b236e3c9048a..757ff158d46f20d5c34678578e38dd6fa15afd51 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/Event.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8747fe6387fcdec07b14c8a72e35868b)
+ * (GenCodeChecksum:c4d88cf24f327dc7f2f303f316e200c7)
  */
 
 /**
@@ -1637,11 +1637,6 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO {
           'html' => [
             'type' => 'EntityRef',
           ],
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.4',
         ],
         'is_share' => [
index 34537d28fa41cf342ff12cf5eea586c52ff1e359..090bb8fe0374698c66ccc13b68bf39e48c79cd4b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Event/Participant.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a746f8f8a28c6f945abbba148794d2c2)
+ * (GenCodeChecksum:f9815c8a89ad1055602bed39a0f266e8)
  */
 
 /**
@@ -495,11 +495,6 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO {
           'bao' => 'CRM_Event_BAO_Participant',
           'localizable' => 0,
           'FKClassName' => 'CRM_Campaign_DAO_Campaign',
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.4',
         ],
         'discount_amount' => [
index 0f754955da189ebd77bf089cf9f863883f046b14..c76e999c8cb9ce06085493fd02c859cb34464ffb 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Mailing/Mailing.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e2de6d8875a7f838b190810bcec4e27e)
+ * (GenCodeChecksum:9e22faebb14e886d7a5b4382249a0da6)
  */
 
 /**
@@ -968,11 +968,6 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
           'html' => [
             'type' => 'Select',
           ],
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.4',
         ],
         'dedupe_email' => [
index 3b4cc6356269cf62a48a85eff040f1c9c279d813..a72f2fc14413b70efeca55a9329acb017d736198 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Member/Membership.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:497f88dd714287acb6b42017dc0b7cd3)
+ * (GenCodeChecksum:614dc19edb8e63eb4a8a4c3523454511)
  */
 
 /**
@@ -502,11 +502,6 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO {
           'html' => [
             'type' => 'Select',
           ],
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.4',
         ],
       ];
index c9ff550a9bf2a7dd739ad86801c3834d21c5b61b..bb23c622e8760b7f01cf5f7103699c6ef9abaf16 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Pledge/Pledge.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8a17ba664d9a2c65860be67652def7f5)
+ * (GenCodeChecksum:b7f0823c6d9fed7969a2734874ed20eb)
  */
 
 /**
@@ -657,11 +657,6 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
           'html' => [
             'type' => 'Select',
           ],
-          'pseudoconstant' => [
-            'table' => 'civicrm_campaign',
-            'keyColumn' => 'id',
-            'labelColumn' => 'title',
-          ],
           'add' => '3.4',
         ],
       ];
index 3f7ee3169ca35cf4d519c9a63a205049dc66d8fd..74f16248640c6b8b990bbeee3b9ea1720d2e716f 100644 (file)
     <title>Campaign</title>
     <import>true</import>
     <comment>The campaign for which this activity has been triggered.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.4</add>
     <html>
       <type>Select</type>
index ea143c1d1c48ef44086f89298577a836b5f03971..1c1b40808209b3dba1a2c2665c7e64c83986027b 100644 (file)
     <type>int unsigned</type>
     <required>true</required>
     <comment>Foreign key to the activity Campaign.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.3</add>
   </field>
   <foreignKey>
index 821af4bd4f415ef0871f8a368a18ac6c56210c46..bfe0cf95c0bbc949ab56376a27a6d1c6a83d6c10 100644 (file)
     <type>int unsigned</type>
     <default>NULL</default>
     <comment>Foreign key to the Campaign.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.3</add>
   </field>
   <foreignKey>
index 6c725b1ddc28e7e5dde385b27d59493e3ba7bf27..b09ee78061f20d8153600f53a610edafeac1d6bd 100644 (file)
     <title>Campaign</title>
     <import>true</import>
     <comment>The campaign for which this contribution has been triggered.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.4</add>
     <html>
       <type>Select</type>
index a8db2380f4a6d0f991df072015d5fecf837ef065..52f1df5eabbc5657d09e60c0e5d5a3dc02544ac2 100644 (file)
     <title>Contribution Page Campaign ID</title>
     <type>int unsigned</type>
     <comment>The campaign for which we are collecting contributions with this page.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.4</add>
   </field>
   <foreignKey>
index fa78706c182e1fd511b5b11cfd840306cd85ef33..fd6b8a948c62f5b124be568b1e24051d81077ea7 100644 (file)
     <title>Campaign</title>
     <import>true</import>
     <comment>The campaign for which this contribution has been triggered.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>4.1</add>
     <html>
       <type>Select</type>
index e6682fe97f27f3bcd7fe8f55d603d5315a6cea23..f0ff62f4eab59d1ce2339637a362ab44764c91e6 100644 (file)
     <type>int unsigned</type>
     <title>Campaign</title>
     <comment>The campaign for which this event has been created.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.4</add>
     <html>
        <type>EntityRef</type>
index 6fd2a94f542b4738098364cd6432165cc6474e00..44ecd7847ed1c853a6825998b75e5965bca6b437 100644 (file)
     <title>Campaign</title>
     <import>true</import>
     <comment>The campaign for which this participant has been registered.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.4</add>
   </field>
   <foreignKey>
index 45264afb44995e93537f9bc937aabdd9cd32382d..0b3422b8c3a687903bf26ce02dd975d6134f9cf7 100644 (file)
     <type>int unsigned</type>
     <title>Mailing Campaign</title>
     <comment>The campaign for which this mailing has been initiated.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.4</add>
     <html>
       <type>Select</type>
index f8be7b3607638e3d0b0a22a3b22f2fe3bf171bf3..4a25c013c582734b361fd4ca163e8599a8bfe2d3 100644 (file)
     <title>Campaign</title>
     <import>true</import>
     <comment>The campaign for which this membership is attached.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.4</add>
     <html>
       <type>Select</type>
index 6b967254f5a088ab8c63e1ecf4e78371fc8e87fa..2f86cdef661f5c6915d8df51a3bf839d288544f7 100644 (file)
     <title>Campaign</title>
     <import>true</import>
     <comment>The campaign for which this pledge has been initiated.</comment>
-    <pseudoconstant>
-      <table>civicrm_campaign</table>
-      <keyColumn>id</keyColumn>
-      <labelColumn>title</labelColumn>
-    </pseudoconstant>
     <add>3.4</add>
     <html>
       <type>Select</type>