Ruby on Rails mysql migrate use Timezone instead of Datetime -


i keeping in mysql table column called

starts_at

my column can different timezone each time.

i have tried creating migration:

def self.up     create_table :meetings, id: false, force: true |t|          t.string       :id          t.timestamp    :starts_at     end end 

but end

datetime

column type

i want force rails use timestamp, , tried of these with no success:

def     change_column :meetings, :starts_at, :timestamp end 

this:

def     change_column :meetings, :starts_at, 'timestamp' end 

and this:

 def self.up     create_table :meetings, id: false, force: true |t|          t.string       :id          t.column       :starts_at, 'timestamp'     end end 

any ideas?

update:

i want save timezone on database record , not on application configuration

rails makes of decisions you. both :timestamp , :datetime default datetime, while :date , :time corresponds date , time, respectively.

using rails, have decide whether need store date, time or both.

so can use type :datetime in :starts_at column.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -