I've created a module for ExpressionEngine and since it's initial installation I need to add a new column to the database. I've managed to create the update funtion in the upd.modulename.php file and it's working. The problem is the code contained to add the new column doesn't seem to be doing what I need it to.
public function update( $current = '' ) {
ee()->load->dbforge();
if ( $current == $this->version ) {
return FALSE;
}
if ( $current < '1.1.0' && ! ee()->db->field_exists( 'new_field', 'module_table' ) ) {
$updates = array(
'new_field' => array(
'type' => 'varchar',
'constraint' => '250'
)
);
ee()->dbforge->add_column( $updates );
}
return TRUE;
}
This conditional is working as I've managed to print out a message when running the module updates but it doesn't appear to be adding the new column to the table. I don't suppose anyone has any ideas?