Wednesday, December 26, 2012

How do I create timestamp type columns in (mySQL) database?

I am working with situation where I would like to maintain timestamp (in UTC) of when a record is created or updated.

mySQL offers such facility if one declares column of type 'timestamp' with attributes - default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'

However I haven't found way to declare a column time as timestamp in django (1.4).

I have come across postings - http://ianrolfe.livejournal.com/36017.html

that tries to define field as timestamp, but it doesn't seem to work.

Is there way to declare column of type  'timestamp' in django and not datetime and assign some properties to the column.

 As a hack I can always execute alter table command, but I am not sure what effect that will have if I want to use admin interface to edit those tables.

Would appreciate any help/pointer on how one can go about handling UTC timestamp columns in database.

Thanks.

-Subodh

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate