diff options
author | Andrey Andreev <narf@devilix.net> | 2015-10-19 12:16:19 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2015-10-19 12:16:19 +0200 |
commit | 95f815745855a5ac365595eb44abbda11766cfe5 (patch) | |
tree | 3c54040a898bbda7d0a1e8293c8965a51244c87e | |
parent | 97d5154c1b50e8c0e73b17355d20126dfaf043fa (diff) |
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 ...
-rw-r--r-- | system/database/DB_forge.php | 8 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
2 files changed, 8 insertions, 1 deletions
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) { diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 950a4a626..72bd9acf9 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -16,6 +16,7 @@ Bug fixes for 3.0.3 - Fixed a bug (#4170) - :doc:`Database <database/index>` method ``insert_id()`` could return an identity from the wrong scope with the 'sqlsrv' driver. - Fixed a bug (#4179) - :doc:`Session Library <libraries/sessions>` doesn't properly maintain its state after ID regeneration with the 'database' driver on PHP7. +- Fixed a bug (#4173) - :doc:`Database Forge <database/forge>` method ``add_key()`` didn't allow creation of non-PRIMARY composite keys after the "bugfix" for #3968. Version 3.0.2 ============= |