MIgrations file for ci_sessions - issue creating a relabelled key as required by CI session library |
[eluser]Ollie Rattue[/eluser]
Just started playing with the migrations library. First table to create is the ci_sessions table as defined in the user guide at http://ellislab.com/codeigniter/user-gui...sions.html as follows: Code: CREATE TABLE IF NOT EXISTS `ci_sessions` ( So I write my definition in application/migrations/001_add_ci_sessions: Code: <?php defined('BASEPATH') OR exit('No direct script access allowed'); The problem is this line: Code: KEY `last_activity_idx` (`last_activity`) The field has been relabelled `last_activity_idx`. It doesn't look like it is possible to do this using the db_forge library - see http://=http://ellislab.com/codeigniter/...ml#add_key So how do I do this? Surely the migrations library is capable of migration a CI predefined schema
[eluser]Unknown[/eluser]
Hate to revive an old thread but here is a solution. Just add this at the end of your up function after you call create_table: Code: $this->db->query('ALTER TABLE `ci_sessions` ADD KEY `last_activity_idx` (`last_activity`)'); Ghetto, but it works. |
Welcome Guest, Not a member yet? Register Sign In |