On Thursday, September 15, 2016 at 6:37:34 AM UTC-7, Ian Nisbet wrote:
>
> Using the following command to copy a MySql to Sqlite DB
>
> $ sequel mysql2://user:password@host/database -C sqlite://db.sqlite
>
>
> But the timestamp format changes to include microseconds in the new Sqlite 
> DB, while the MySql did not include them: e.g. *2016-09-15 11:35:46* 
> become *2016-09-15 11:35:46.000000*
>
> Is there a way to control the format during conversion?
>

 Add a file named disable_fractional_timestamps.rb with the following code:

  require 'sequel/adapters/shared/sqlite'
  module Sequel::SQLite::DatasetMethods
    def supports_timestamp_usecs?; false; end
  end

Then run the following command line:

  sequel mysql2://user:password@host/database -C sqlite://db.sqlite -r 
./disable_fractional_timestamps.rb

I haven't actually tested that, but something like it should work. 
 Basically, you just need to tell Sequel not to use fractional seconds on 
SQLite.

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