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
Post a Comment