![]() |
dbforge - can only be one auto column and it must be defined as a key - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: dbforge - can only be one auto column and it must be defined as a key (/showthread.php?tid=63453) |
dbforge - can only be one auto column and it must be defined as a key - Kemik - 10-31-2015 Hi guys, Just wondering if you could assist with an error I'm seeing. The code: PHP Code: $this->dbforge->add_field('post_id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT'); The error: Quote:Incorrect table definition; there can be only one auto column and it must be defined as a key It looks to be like the primary key element isn't being added to the query. Do you have any suggestions? Thanks! RE: dbforge - can only be one auto column and it must be defined as a key - orionstar - 10-31-2015 Try to use an array as a parameter with the add_field method. And check the userguide: http://www.codeigniter.com/user_guide/database/forge.html#adding-fields Quote:Passing raw strings as fields cannot be followed by add_key() calls on those fields. RE: dbforge - can only be one auto column and it must be defined as a key - Kemik - 11-01-2015 (10-31-2015, 08:56 PM)orionstar Wrote: Try to use an array as a parameter with the add_field method. Bah, I read the userguide but missed that large Note box haha. Did try passing an array before I posted the thread but it gave the same result. Turns out the document wasn't uploading when I was saving it... your suggestion worked now that I have the ftp working again. Cheers! |