简体   繁体   中英

How to define composite primary key using codeIgniter migrations?

i convert my database to migrations successfully, except the following line:

 PRIMARY KEY (`key_id`,`user_id`);

Currently i doing it as:

$this->dbforge->add_key('key_id,user_id',TRUE);

but no Luck. gives the following Error:

 Error Number: 1072<p>Key column 'key_id,user_id' doesn't exist</p>

can anyone help? sorry for English Grammar and if i am not clear.

Thanks i found the solution my self:

$this->dbforge->add_key('key_id', TRUE);
$this->dbforge->add_key('user_id', TRUE);

here is the source link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM