From: Eileen McNaughton Date: Thu, 24 Jun 2021 03:24:46 +0000 (+1200) Subject: Fix support for composite primary keys X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=179eeacb16e4f2b8ace1b3c75c3164e9f0039c43;p=civicrm-core.git Fix support for composite primary keys Fixes what looks like an oversight https://github.com/civicrm/civicrm-core/commit/022785d8d5d4876aa1211b7adc0d7c31e2995fc5#diff-08ba0d294c1f2e5b9d42e4768aa3b30a10e5128809c590f155c5ac0cc9b2f69cL480-L481 An 'if' was added but the uncondition line left in The result is that if a composite primary field IS defined per below an entry for it is incorrectly added to the field array with just autoincrement set. ` contact_timestamp_type contact_identifier recipient_action_datetime event_type ` --- diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index 4d476550a4..f230088797 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -514,7 +514,7 @@ class CRM_Core_CodeGen_Specification { if (isset($fields[$name])) { $fields[$name]['autoincrement'] = $auto; } - $fields[$name]['autoincrement'] = $auto; + $primaryKey = [ 'name' => $name, 'autoincrement' => $auto,