From 95f815745855a5ac365595eb44abbda11766cfe5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 19 Oct 2015 13:16:19 +0300 Subject: Fix #4173 This reverts commit 7cc6cea2d421862726081a39e932dbceeefcc775 from PR #3968. At the time this seemed logical, but turns out it breaks the ability to create non-PRIMARY composite keys, so ... --- system/database/DB_forge.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php index dde285598..f9cf76a14 100644 --- a/system/database/DB_forge.php +++ b/system/database/DB_forge.php @@ -239,7 +239,13 @@ abstract class CI_DB_forge { */ public function add_key($key, $primary = FALSE) { - if (is_array($key)) + // DO NOT change this! This condition is only applicable + // for PRIMARY keys because you can only have one such, + // and therefore all fields you add to it will be included + // in the same, composite PRIMARY KEY. + // + // It's not the same for regular indexes. + if ($primary === TRUE && is_array($key)) { foreach ($key as $one) { -- cgit v1.2.3-24-g4f1b