CodeIgniter Forums
Database Forge Class - COLLATE attribute - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Database Forge Class - COLLATE attribute (/showthread.php?tid=69151)



Database Forge Class - COLLATE attribute - glorsh66 - 10-14-2017

is it possible using DBforge - make a new field with 'COLLATE' => 'utf8_bin',?


RE: Database Forge Class - COLLATE attribute - dave friend - 10-14-2017

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'.


RE: Database Forge Class - COLLATE attribute - glorsh66 - 10-15-2017

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");