Plugin Use Default Value When Empty I've got a default value defined in my model for a field

'limit' =&gt; array(AttributeType::Number, 'default' =&gt; 0)


When I create a new record, if the limit field is empty, NULL gets stored in the DB instead of 0. I thought $model->setAttributes() would set the default values if the values coming in were NULL. What am I missing?
If you want to add a default to an existing column in a table in a migration, you'd do something like this:

$this-&gt;alterColumn('tableName', 'columnName', array('column' =&gt; ColumnType::Number, 'default' =&gt; 0));


If you want to add a default to a new column in a table in a migration, you'd do something like this:

$this-&gt;addColumn('tableName', 'columnName', array('column' =&gt; ColumnType::Number, 'default' =&gt; 0));