Sep. 30th, 2010

janewilliams20: (geek)
"Default values must be constants. This means, for example, that you cannot set the default for a date column to be the value of a function such as NOW() or CURRENT_DATE"

[[headdesk]] Set a column to default to the current date/time? Say, one called "createddate"? Why would I ever want to do that? It's not as if keeping an audit trail is something any serious DB would ever want to do.....

What you can do is "The exception is that you can specify CURRENT_TIMESTAMP as the default for a TIMESTAMP column."
But Timestamp is not the same as datetime.... it'll do, but it's limited.

Also, I can either default my "created at" timestamp, OR do a "on update current_timestamp" to store the updated date in another column. Not both. MySQL can only cope with one per table.

aarrgh.... let me back to proper grown-up databases again! Even Microsoft ones!

Profile

janewilliams20: (Default)
janewilliams20

June 2020

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 5th, 2025 11:51 pm
Powered by Dreamwidth Studios