CodeIgniter Forums

Full Version: Database Forge Class - COLLATE attribute
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is it possible using DBforge - make a new field with 'COLLATE' => 'utf8_bin',?
It should be. Have you tried this?

PHP Code:
$fields =[
 
   'field_name' => [
 
        'type' => 'TEXT',
 
        'COLLATE' => 'utf8_bin',
 
     ],
];
$this->dbforge->add_column('table_name'$fields); 

If your table has defined a COLLATE option then that will be used automatically for new fields. Also, keep in mind that $this->dbforge->create_table(... will use the value of 'dbcollat' found in config/database.php. Same is true for 'char_set'.
It is not working.
I managed to make this only this way
$this->dbforge->add_field("`password` CHAR(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL");