On Friday, January 13, 2017 at 6:50:04 AM UTC-8, George Millo wrote: > > I'm using postgresql, and I want to set the default value of a timestamp > column to the current time. If I was writing pure PSQL with a CREATE TABLE > I'd do something like column_name TIMESTAMP DEFAULT clock_timestamp(). Is > there a way I can create a table like this without having to write too much > raw SQL? > > I've tried: > > create_table :my_table do > DateTime :my_timestamp, default: "clock_timestamp" > end > > but it fails with PG::InvalidDatetimeFormat: ERROR: invalid input syntax > for type timestamp: "clock_timestamp()" >
default: Sequel.function(:clock_timestamp) or default: Sequel.lit("clock_timestamp()") 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 sequel-talk+unsubscr...@googlegroups.com. To post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.