TimeStamp fields being altered by who?

Discussion of open issues, suggestions and bugs regarding database management and administration tools for MySQL
Post Reply
chrisdouglass
Posts: 15
Joined: Fri 11 Aug 2006 14:04
Location: Atlanta, GA USA

TimeStamp fields being altered by who?

Post by chrisdouglass » Fri 01 Sep 2006 16:02

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

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Sat 02 Sep 2006 10:48

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.

chrisdouglass
Posts: 15
Joined: Fri 11 Aug 2006 14:04
Location: Atlanta, GA USA

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

Post by chrisdouglass » Sat 02 Sep 2006 11:39

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...

Duke
Devart Team
Posts: 476
Joined: Fri 29 Oct 2004 09:25

Post by Duke » Sat 02 Sep 2006 12:15

MySQL server itself adds this clause when you set NOT NULL flag for the TIMESTAMP column.

chrisdouglass
Posts: 15
Joined: Fri 11 Aug 2006 14:04
Location: Atlanta, GA USA

Post by chrisdouglass » Tue 05 Sep 2006 15:57

I see. Thanks, I'm switching to DateTime and doing timestamps by hand for now... I don't like things happening without my knowledge.

Post Reply