![]() |
dbforge create key/index on existing table - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: dbforge create key/index on existing table (/showthread.php?tid=50707) |
dbforge create key/index on existing table - El Forum - 04-05-2012 [eluser]GlennJ[/eluser] I can create a new table with a key using DB Forge, that's pretty easy. However, there doesn't seem to be an option to add a key to an existing table? Am I being dense and missing something here? This is for an ExpressionEngine module, so I want to do it the correct way. dbforge create key/index on existing table - El Forum - 04-05-2012 [eluser]InsiteFX[/eluser] Something like this: Code: $this->db->query("ALTER TABLE table_name ADD COLUMN column_name varchar(255)"); dbforge create key/index on existing table - El Forum - 04-05-2012 [eluser]GlennJ[/eluser] That doesn't use dbforge though, so it'll only work for MySQL databases. dbforge create key/index on existing table - El Forum - 04-24-2012 [eluser]John Morton[/eluser] Glenn, Did you find out how to add the key? I'm looking for the same answer. -John dbforge create key/index on existing table - El Forum - 04-24-2012 [eluser]GlennJ[/eluser] [quote author="John Morton" date="1335279479"]Glenn, Did you find out how to add the key? I'm looking for the same answer. -John[/quote] You can't using DB Forge buy the looks of things, maybe this is because of compatibility across different database types. For me, as ExpressionEngine only supports MySQL, I did it using a SQL query. dbforge create key/index on existing table - El Forum - 04-24-2012 [eluser]John Morton[/eluser] Same here. Trying to update a DB for an EE add on, so I will go the SQL route as well. DBForge seemed like a good choice for future compatibly, you know, in case EE supported other DBs in the future, but I can deal with this again if that ever becomes an issue. Thanks for the quick reply. |