[eluser]Cambo[/eluser]
HI
Currently I have this in the DB_forge file to allow assigning the ENGINE type as sometimes I want to create InnoDB tables.
The problem is if I upgrade CI I have to remember not to overwrite this file. I want to extend db_forge like you can extend the libraries, so the code is in the application folders instead, and I dont have to worry about upgrades, etc.
Any clues on how to do this?
TIA
Cambo
Code:
/**
* Create Table - modified to include table type
*
* @access public
* @param string the table name
* @return bool
*/
function create_table($table = '', $if_not_exists = FALSE, $engine = null)
{
if ($table == '')
{
show_error('A table name is required for that operation.');
}
if (count($this->fields) == 0)
{
show_error('Field information is required.');
}
$sql = $this->_create_table($this->db->dbprefix.$table, $this->fields, $this->primary_keys, $this->keys, $if_not_exists);
if(!is_null($engine)) { $sql = rtrim($sql, ";"); $sql .= ' ENGINE='.strtoupper($engine); }
$this->_reset();
return $this->db->query($sql);
}