[development] no date / time types in schema API

augustin (beginner) drupal.beginner at wechange.org
Wed Jul 2 10:18:55 UTC 2008


Hi,

http://en.wikibooks.org/wiki/SQL_dialects_reference/Data_structure_definition/Data_types/Date_and_time_types
All (but one) SQL dialects have a date type. 
However, Drupal's Schema API does not seem to have a type for date only:
http://drupal.org/node/159605

It causes schema.module to complain: no type for Schema type date:normal.
I am concerned that with the new Schema API, my modules may not install 
properly anymore. (how can it install a table where a column has an 
unsupported type?)

Is this a purposeful omission? 

I just found this issue:
http://drupal.org/node/200953
so others noticed, too :)

How are you all coping with the lack of time/date data type? 
What workarounds do you use?

I could use the data type datetime,  but then I have to worry about truncating 
the time part which I do not need. I use substr() to truncate the part I 
don't want, but coder.module complains about it (says I should use 
drupal_substr() while substr() is quicker and safe in this case).

There is probably a better way to truncate the time part (please say), but it 
feels a shame to have to deal with the extraneous time part when Schema API 
could easily handle date types. 



Blessings,


Augustin.



More information about the development mailing list