CodeIgniter Forums

Full Version: DBFORGE add field zerofill
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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 ?

DBForge does not have a zerofill parameter according to the documentation.
Just do it manually: 
PHP Code:
$this->dbforge->add_field("month TINYINT(2) UNSIGNED ZEROFILL NOT NULL"); 
I solve this problem setting ZEROFILL after field type and lenght, like this:

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