rails: date type and GetDate
- by cbrulak
This is a follow up to this question: http://stackoverflow.com/questions/2930256/unique-responses-rails-gem
I'm going to create an index based on the user id, url and a date type.
I want date type (not datetime type) because I want the day, the 24 hour day to be part of the index to avoid duplication of page views counts on the same day.
In other words: A view only counts once in a day by a visitor.
I also want the default value of that column (viewdate) to be the function GETDATE().
This is what I have in my migration:
execute "ALTER TABLEpage_viewsADD COLUMN viewdate datetime DEFAULTGETDATE()`"
But the value viewdate is always empty. What am I missing?
(as an aside, any other suggestions for accomplishing this goal?)