![]() |
How to Specify InnoDB table type - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to Specify InnoDB table type (/showthread.php?tid=10966) |
How to Specify InnoDB table type - El Forum - 08-20-2008 [eluser]CW[/eluser] I'm using Database Forge to create MySQL tables by defining fields in an array and creating tables as specified in the documentation. In this process is there a way to specify the table type as InnoDB? Thanks, CW How to Specify InnoDB table type - El Forum - 08-20-2008 [eluser]Randy Casburn[/eluser] After a quick check of the code the answer is NO. There is no Engine='' option put into the SQL that creates the DB. Randy How to Specify InnoDB table type - El Forum - 08-20-2008 [eluser]CW[/eluser] That's what I suspected so I used: $this->db->query("CREATE TABLE `hello` ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=InnoDB AUTO_INCREMENT=1 "); To get around this. How to Specify InnoDB table type - El Forum - 08-20-2008 [eluser]Randy Casburn[/eluser] [quote author="CW" date="1219267323"]That's what I suspected so I used: $this->db->query("CREATE TABLE `hello` ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=InnoDB AUTO_INCREMENT=1 "); To get around this.[/quote] Just to be a nerd, TYPE= is deprecated, ENGINE= is now preferred. But it won't matter for some time. Randy How to Specify InnoDB table type - El Forum - 08-20-2008 [eluser]CW[/eluser] Thanks for the comment. :exclaim: I've been taking my cues from phpMyAdmin which outputs Type when you generate sql export. :red: For what it's worth, CI might consider adding an Engine=’’ option since transactions are promoted in the documentation and InnoDB is needed for that. CW How to Specify InnoDB table type - El Forum - 08-20-2008 [eluser]Randy Casburn[/eluser] I'm betting very very few of us use transaction, store procs, triggers, views or any of the really cool things MySQL will do :coolsmile: |