phpcodeigniterdbforge

CodeIgniter / dbForge - multiple keys


Im using CodeIgniters DBforge to use my database.

Im trying to convert a plain PHP script to CodeIgniter and im having some trouble with changing the SQL to dbforge.

I have the following SQL code

CREATE TABLE `message2_recips` (
  `mid` int(10) unsigned NOT NULL,
  `seq` int(10) unsigned NOT NULL,
  `uid` int(10) unsigned NOT NULL,
  `status` char(1) NOT NULL default 'N',
  KEY `m2r1` USING BTREE (`mid`,`status`),
  KEY `m2r2` USING BTREE (`uid`,`status`)
) ENGINE=InnoDB;

Everything works fine except when i get to the 2 key values at the bottom.

Everything i have tried doesnt seem to work including,

$this->dbforge->add_key(array('mid', 'status'));
$this->dbforge->add_key(array('uid', 'status'));

Any help translating this would be greatly appreciated, i cant seem to find any way to input this using dbforge, which brings my project to a complete standstill

Thanks.


Solution

  • Impossible to do (currently) via DB Forge - it doesn't support additional options for table keys. You can only achieve that by adding them afterwards with raw SQL queries.