On Monday, June 15, 2015 at 10:32:07 AM UTC-7, Wesley Staples wrote:
>
> I would like to create a mysql column that has an on update clause. I 
> can't seem to figure this one out. I tried to dump a table that had one but 
> the generated migration did not have it. I can set the 
> default=>Sequel::CURRENT_TIMESTAMP but I would like this to occur on update 
> as well. 
>

Sequel only supports ON UPDATE when used in foreign key constraints, 
MySQL's use of the ON UPDATE syntax for automatically updated timestamps is 
not standard and Sequel doesn't support it.  

You can manually create the table using raw SQL, or if you want to cheat, 
you can abuse the :default option:

  :default=>Sequel.lit('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP')

For database specific SQL like this, I'd recommend just doing raw SQL:

  DB.run "CREATE TABLE ...."

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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to