On Thursday, December 3, 2020 at 12:00:20 AM UTC-6 Jeremy Evans wrote:

> On Wed, Dec 2, 2020 at 8:42 PM J. Lewis Muir wrote:
>
>> One of my deployment targets is RHEL 7, and Ruby is at 2.0 there, so it 
>> would be great if that could still be used and not require 2.6.
>>
>
> If you can use Ruby 2.0, you should be able to easily use the mysql gem.  
> Current Sequel runs fine on Ruby 2.0.  You will have to switch to 
> Sequel.datetime_class = DateTime, though, because timezone support was not 
> added to Time until Ruby 2.6.
>

Just to close out this conversation, I would normally be happy to switch to 
the mysql gem, but I don't want to when it has no maintainer and you have 
to patch it to work with newer versions of Ruby.  So, now I don't use the 
:named_timezones extension, I convert all times in my application to UTC 
before passing them to Sequel, I use the following configuration, and I 
require that the application machine's time zone is set to the same time 
zone as the DB machine:

----
Sequel.application_timezone = :utc
Sequel.database_timezone = :local
----

I tested this, and it works.  (I suppose it might be possible to soften the 
application machine time zone requirement of being set to the same time 
zone as the DB machine by setting the time zone for just the application 
via the TZ environment variable [or some other method] rather than 
requiring the time zone of the machine to be set, but I haven't tried that.)

If the Mysql2 driver ever supports named time zones, and the Sequel adapter 
works with it, then I'd be interested in revisiting this.

Thanks for all your help!

Lewis

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/b7d3010d-e0c0-467e-9b67-a4615db4cabfn%40googlegroups.com.

Reply via email to