[mysql] Change a column type from Date to DateTime during ROR migration

I need to change my column type from date to datetime for an app I am making. I don't care about the data as its still being developed.

How can I do this?

This question is related to mysql ruby-on-rails ruby ruby-on-rails-3 migration

The answer is

First in your terminal:

rails g migration change_date_format_in_my_table

Then in your migration file:

For Rails >= 3.2:

class ChangeDateFormatInMyTable < ActiveRecord::Migration
  def up
    change_column :my_table, :my_column, :datetime

  def down
    change_column :my_table, :my_column, :date

Similar questions with mysql tag:

Similar questions with ruby-on-rails tag:

Similar questions with ruby tag:

Similar questions with ruby-on-rails-3 tag:

Similar questions with migration tag: