On Jan 21, 7:58 am, Iain Barnett <[email protected]> wrote:
> Hi,
>
> I was wondering if there's an alloted place/way for adding helpers to
> migrations? Obviously I can just add them in the normal Rubyish ways, but
> if there's something better (as a plugin, for example) then I'll use that.
>
> Right now, it's to add in this in particular:
>
>     def default_datetime
>       if DB.database_type == :sqlite
>         "(datetime('now','localtime'))".lit
>       else
>         Sequel::CURRENT_TIMESTAMP
>       end
>     end
>
> Any insight will be gratefully accepted.

If you are using bin/sequel to migrate, you would just put that code
in some file, and use the -I and/or -r flags to bin/sequel to load it
(in addition to the -m/-M to migrate).

In terms of where to place it, if you are only going to be using it in
migrations, a class method should be fine.

My bigger question is why Sequel::CURRENT_TIMESTAMP doesn't work
correctly for you on SQLite.  The current Sequel code does this:

    datetime(CURRENT_TIMESTAMP, 'localtime')

Is 'now' different than CURRENT_TIMESTAMP there?

Jeremy

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to