![]() |
DBForge - Create table with Engine MyISAM - 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 table with Engine MyISAM (/showthread.php?tid=43840) |
DBForge - Create table with Engine MyISAM - El Forum - 07-25-2011 [eluser]esthezia[/eluser] Hello there! How can I create a table with DBForge with MyISAM Engine? I wish to specifically create it with this engine and not letting codeigniter make it with what engine it wants. I'm using CI 2.0.2. The first time I created a table it made it MyISAM, but now I see that it automatically creates it InnoDB. Please help! Thank you! DBForge - Create table with Engine MyISAM - El Forum - 07-25-2011 [eluser]InsiteFX[/eluser] Code: // -------------------------------------------------------------------- DBForge - Create table with Engine MyISAM - El Forum - 07-26-2011 [eluser]esthezia[/eluser] thank you for your reply! is this the only way? i was hoping for something using the built-in DBForge functions. DBForge - Create table with Engine MyISAM - El Forum - 07-26-2011 [eluser]InsiteFX[/eluser] Yes, because DBForge doe's not have a way to create a new table. I wrote that for someone else that was having the same problem. DBForge - Create table with Engine MyISAM - El Forum - 07-27-2011 [eluser]esthezia[/eluser] [quote author="InsiteFX" date="1311734219"]Yes, because DBForge doe's not have a way to create a new table.[/quote] I believe it does. See here. But it seems that the engine cannot be specified. Thank you! DBForge - Create table with Engine MyISAM - El Forum - 07-27-2011 [eluser]InsiteFX[/eluser] Yes but it defaults to the Innodb not MyISAM which is what he wants to use. DBForge - Create table with Engine MyISAM - El Forum - 09-12-2012 [eluser]yacman[/eluser] The least path of resistance, if you wish to have MYISAM exclusively is to overload the CI_DB_Forge_mysql class. To do this you will need to create a MY_Loader.php class file located in your application/core folder. This is from the sparks generated loader class, abreviated with the additional dbforge overload. Code: <?php if (! defined('BASEPATH')) exit('No direct script access allowed'); Next Create a file in your application/libraries folder called: MY_CI_DB_mysql_forge.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Adding these will enable the $this->dbforge->create_table() method to return the sql for a MYISAM table. If you have access to the mysql instance, you could force the default table engine to be MYISAM or whatever using the --default-storage-engine or --default-table-type at startup. This is a pretty good write up I found as well for older versions of CI DBForge - Create table with Engine MyISAM - El Forum - 02-09-2013 [eluser]Kaabi[/eluser] You can put this line after dbforge create_table Code: $this->db->query('ALTER TABLE `table_name` ENGINE = MYISAM'); DBForge - Create table with Engine MyISAM - El Forum - 12-28-2013 [eluser]Unknown[/eluser] Set default engine to MYISAM before creating tables: Code: $this->db->query('SET storage_engine=MYISAM;'); Reference: http://dev.mysql.com/doc/refman/5.7/en/storage-engine-setting.html |