Timestamp set NOT NULL with default vaule as NOW()

I’m posting it here because i think is bug, but well, i’m not fully sure.

In my tables i’ve an atribute created_at defined as NOT NULL and as default value NOW().

I create the controller with the command crud in the yiic shell. The ‘bug’ is that the model created with the crud operation demands a value for created_at, when it have defined a default vaule, so is not necessary to fill this value, it will fill itself with his deafult value.

So here what I would espect of the model is that even i’ve set the field as not null, also i’ve set a default value for it, so it should’t the model should’nt demand a value for the field.

Correct me if i’m wrong.

i think you must shield "create_at" field in your form~

because in database, only when create_at is null use now(),

but ""(empty) is not equal null~~

just remove ‘created_at’ from the required rule in ur model

Ummm, so you’re saying that yii model instead sending a null value (not include the created_at in the INSERT statment) will send a “” value? But if you’ve the field defined as not null and send this value, the result will be “00/00/00”, never null.

Also i don’t want to send it to the form this value, is not for display purpouses this field, is created to trace the flow of data (when something is added or modified). In fact if i remove the value from the form, and modify the model to make created_at not mandatory, its created as spected, with the current time.

I know I can do this, but i was discussing here the default behavior of the model shell script, if it was correct set the field created_at as mandatory, because it doesn’t need to be due database dessign.