db_forge->add_key does not create multiple-column indexes |
[eluser]vrencianz[/eluser]
The following lines Code: $this->dbforge->add_key(array(array('status', 'created'), array('status', 'title'))); Code: $this->dbforge->add_key(array('status', 'created')); generates the following error: Code: Duplicate key name 'status' The problem is the db_forge function Code: function add_key($key = '', $primary = FALSE) which explodes recursively any array when mysql _create_table expects arrays for multiple-column indexes. Code: if (is_array($keys) && count($keys) > 0) Thank you!
[eluser]InsiteFX[/eluser]
Maybe because you are using the same name status for both keys. You can only have one key named status!
[eluser]vrencianz[/eluser]
Thank you for the fast reply According to the documentation Code: $this->dbforge->add_key(array('blog_name', 'blog_label')); the expected keys are (also the _create_table wants to do that) Code: $this->dbforge->add_key(array('status', 'created')); Please observe (as the first post lists it) that the add_key reduces any array to its keys (and sub-keys if the key is an array) and for multiple-column keys imploded-underscored field names are used.
[eluser]vrencianz[/eluser]
It seams that this one is fixed here: https://github.com/harryxu/CodeIgniter/c...76c7d4fb34. Thanks! |
Welcome Guest, Not a member yet? Register Sign In |