Thursday 15 March 2012

postgresql - is there a cross-db Rails way to get the unix timestamp representation of updated_at -


We are testing a MySQL -> Postgres (and Postgres noob) migration and the following are:

< Select <> (['id', 'name', 'conset (unix_timestamp (updated_at) timestamp)]] command (' condition acc ')

It looks as if there is a way to postgres:

  as timestamp (['id', 'name', 'extraordinary era]]]). The order ('condition')  

Is there a cross-db or is it expected that an updated_at time stages the way to perform an integer?

thx

 

How to use to_i Prettyprint-override"> yourmodel.select (: id ,: name, updated_at) .order (status: : Asc) .each do | Your_model | Timestamp = your_model.updated_at.to_i # Other code end

This should work fine with MySQL and Postgres.


No comments:

Post a Comment