Createtable With Column Default To Zero

Hi folks,

I am in the middle of altering a table that I created. The change I want to make is that it currently defaults to NULL when a record is entered at there is a value of NULL for that column… I want this to default to 0 when this happens, rather than it being left as null. Any ideas how I can do this?

I am fine with the syntax for creating table/columns in general, I just need to change this line I think…

'product_count' => 'integer',

Can anyone help me please?

Hi you may either, go to mysql and set the default value to sth (you can easily do this in phpmyadmin)or if I am not mistaken you can do this.

array('attr1, attr2', 'default', 'value'=>'something')

you can follow this link:



just for reference, I ended up using syntax like this: -

'updated' => 'boolean NOT NULL DEFAULT \'0\'',