CodeIgniter Forums
DBFORGE add field zerofill - 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: DBFORGE add field zerofill (/showthread.php?tid=70075)



DBFORGE add field zerofill - flav - 02-16-2018

Hi,

I would like to create a table with a field tinyint(2) unsigned zerofill. When I try the statement below column is created but zerofill don't work. 

'month' => array(
                    'type' => 'TINYINT',
                    'constraint' => '2',
                    'unsigned' => TRUE,
                    'zerofill' => TRUE)


Do you have the solution ? Is my syntax correct ?

Thanks


RE: DBFORGE add field zerofill - InsiteFX - 02-16-2018

DBForge does not have a zerofill parameter according to the documentation.


RE: DBFORGE add field zerofill - Avenirer - 02-17-2018

Just do it manually: 
PHP Code:
$this->dbforge->add_field("month TINYINT(2) UNSIGNED ZEROFILL NOT NULL"); 



RE: DBFORGE add field zerofill - Wanderson Neves - 12-12-2018

Hello,
I solve this problem setting ZEROFILL after field type and lenght, like this:

$fields= array(
'month' => array(
'type' => 'TINYINT(2) ZEROFILL',
'unsigned' => TRUE)
);