{"action":"opened","issue":{"url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4173","labels_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4173/labels{/name}","comments_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4173/comments","events_url":"https://api.github.com/repos/bcit-ci/CodeIgniter/issues/4173/events","html_url":"https://github.com/bcit-ci/CodeIgniter/issues/4173","id":111642133,"number":4173,"title":"Error with composite keys created in DBForge","user":{"login":"irobotham","id":6844623,"avatar_url":"https://avatars.githubusercontent.com/u/6844623?v=3","gravatar_id":"","url":"https://api.github.com/users/irobotham","html_url":"https://github.com/irobotham","followers_url":"https://api.github.com/users/irobotham/followers","following_url":"https://api.github.com/users/irobotham/following{/other_user}","gists_url":"https://api.github.com/users/irobotham/gists{/gist_id}","starred_url":"https://api.github.com/users/irobotham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irobotham/subscriptions","organizations_url":"https://api.github.com/users/irobotham/orgs","repos_url":"https://api.github.com/users/irobotham/repos","events_url":"https://api.github.com/users/irobotham/events{/privacy}","received_events_url":"https://api.github.com/users/irobotham/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-15T15:27:01Z","updated_at":"2015-10-15T15:27:01Z","closed_at":null,"body":"A bug fix in 3.0.1 means that it is not possible to create composite keys as the behaviour for passing in an array now creates multiple individual keys rather than one key across a number of columns.\r\n\r\nThe change was introduced via https://github.com/bcit-ci/CodeIgniter/pull/3968 but this changes behaviour originally added in https://github.com/bcit-ci/CodeIgniter/commit/75f405b64ec0dff23bcaf73c9bc805b3804f2863\r\n\r\nThe documentation states \"Multiple column non-primary keys must be sent as an array.\" and gives the example:\r\n\r\n```php\r\n$this->dbforge->add_key(array('blog_name', 'blog_label'));\r\n// gives KEY `blog_name_blog_label` (`blog_name`, `blog_label`)\r\n```\r\n\r\nAs I see it, there are a couple of options:\r\n\r\n1. Keep the fix and update the documentation to state that composite keys are not supported.\r\n2. Revert the fix and update the documentation to advise users who want to create multiple keys to just make multiple add_key() calls\r\n3. Introduce a new method to handle a use case - I suggest either add_keys() or add_composite_key() to provide the expected behaviour."}}