Needs work
Project:
Drupal core
Version:
main
Component:
database system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Jan 2008 at 13:04 UTC
Updated:
14 Nov 2022 at 12:38 UTC
Jump to comment: Most recent
Comments
Comment #1
panchoThis is a bug, as it's torpeding usage of the Schema API and therefore endangering the dbs abstraction.
Comment #2
moshe weitzman commentedwhat about current_timestamp? any others like this?
Comment #3
traxer commentedThe behaviour of Drupal's database system does not deviate from what is documented. Also, having the database take care of setting the time by itself is nice to have, but not critical to the usage of a database abstraction layer. So this is a feature request.
The MySQL implementation of the Schema API implements the
datetimefield using MySQL's DATETIME type. That type does not support automatic initializiation/update to the current time.MySQL's type TIMESTAMP supports automatic initializiation/update to the current time. Switching from DATETIME to TIMESTAMP is not an option, though:
See http://dev.mysql.com/doc/refman/4.1/en/timestamp.html for details.
Comment #4
scoutbaker commentedAs a feature request, I'm moving this to D7.
Comment #5
Crell commentedAnd now to D8.
Comment #6
geerlingguy commentedAnd now I subscribe.
Comment #7
dozymoe commented0.0
Comment #8
cosmicdreams commentedrunning into this issue currently. So this appears to be an issue that looking for a solution that tells the DB to properly set a default value when the row is created in the DB.
But I need a solution now. Can I just set the type of the field to datetime and set it's value on node_create?
Comment #9
damien tournoud commented7.x and 8.x do *not* support datetime fields.
Comment #10
BAM5 commentedDatetime fields are supported, just not as a 'type' type. You have to specify it through the 'mysql_type' and equivalent properties for other database drivers. Besides, who says that datetime fields won't ever be supported in the future making this request completely relevant?
Also, the now() function does not work for inserting values, now() is once again turned into a string quotation.
Comment #11
smartango commentedbeing for d8, what about this schema definition:
then in core code:
I put 'on update' because it is present in mysql, how to manage this? any plan? (want do/dont want ..)
- EDIT: is_callable does not really work correctly
- EDIT 2: style
- EDIT 3: I neither look at code, what is ESCAPE?
Comment #12
Crell commentedThe schema array is currently serialized, and anonymous functions cannot be serialized.
Comment #15
aaronbaumanShall we call this "won't fix" then?
Comment #20
hkirsman commented+1 - would be nice to have!
Comment #22
drupaldope commentedI need this too.
Comment #27
bhanu951 commented