Thank you! It looks a bit strange (singleton method definition instead of 
some configuration) and dangerous (if the original method will be changed), 
but for now it works.

On Friday, December 1, 2017 at 5:55:30 PM UTC+3, Jeremy Evans wrote:
>
> On Friday, December 1, 2017 at 6:07:32 AM UTC-8, Alexander Popov wrote:
>>
>> Hello!
>>
>> Code:
>>
>> add_column :deadline, :timestamptz, default: 
>> Sequel.date_add(Sequel::CURRENT_TIMESTAMP, 
>> days: 14))
>>
>> Expected default value:
>>
>> (CURRENT_TIMESTAMP + '14 days'::interval)
>>
>> Actual default value:
>>
>> (CURRENT_TIMESTAMP::timestamp without time zone + '14 days'::interval)
>>
>> What is this casting for? Deadline is not wall-clock, it's a point in the 
>> absolute time.
>>
>
> Sequel just casts to Time, which uses the timestamp type by default.  You 
> would probably need to override that to use timestamptz:
>
> def DB.type_literal_generic_time(column)
>   column[:only_time] ? :time : :timestamptz
> end
>
> Thanks,
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to