Page 1 of 1

TimeStamp fields being altered by who?

Posted: Fri 01 Sep 2006 16:02
by chrisdouglass
When I create TIMESTAMP fields in my database, I'm noticing that when I save the table changes and then script over the database to export the schema the export contains changes to the timestamp fields that I did not make. For example:

`LastUpdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP

The DEFAULT and ON UPDATE clauses and values were not specified by me. And, after reading about the gotchas regarding the handling of TIMESTAMP fields on mysql.com, I want to let my application handle the updates to these fields. But, either the CRLab .NetDirect add-in within Visual Studio is adding these clauses/values or MySQL itself is adding them.

Do you know anything about this type of problem with TIMESTAMP field definitions being altered without our knowledge?

Thanks,
Chris

Posted: Sat 02 Sep 2006 10:48
by Alexey
How do you create fields and save changes to your database? Why do you think it has anything to do with MySQLDirect .NET data provider? Please describe in detail.

It's the only tool I use to create my schema

Posted: Sat 02 Sep 2006 11:39
by chrisdouglass
I use only the CRLab mySQL add-in to create my databases and schema. And, I explictly went through all of my TimeStamp fields and ensured they didn't have a default value, clicked save within VisualStudio and then immediately right click on my database and did an Export within DBExplorer. And, the export script shows not only default values but ON UPDATE clauses added to my fields.

I'm not using any other tool. Thus, do you think MySQL would alter my fields b/c it would be the only other entity that touches my data.

I will try and isolate the problem. Maybe the problem is in the Export or maybe it's in the code behind DBExplorer... who knows...

Posted: Sat 02 Sep 2006 12:15
by Duke
MySQL server itself adds this clause when you set NOT NULL flag for the TIMESTAMP column.

Posted: Tue 05 Sep 2006 15:57
by chrisdouglass
I see. Thanks, I'm switching to DateTime and doing timestamps by hand for now... I don't like things happening without my knowledge.