Yet more MySQL limitations
Sep. 30th, 2010 04:11 pm"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!
[[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!