DBForge - Create table with Engine MyISAM |
[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!
[eluser]InsiteFX[/eluser]
Code: // --------------------------------------------------------------------
[eluser]esthezia[/eluser]
thank you for your reply! is this the only way? i was hoping for something using the built-in DBForge functions.
[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.
[eluser]InsiteFX[/eluser]
Yes but it defaults to the Innodb not MyISAM which is what he wants to use.
[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
[eluser]Kaabi[/eluser]
You can put this line after dbforge create_table Code: $this->db->query('ALTER TABLE `table_name` ENGINE = MYISAM');
[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/s...tting.html |
Welcome Guest, Not a member yet? Register Sign In |