Hope you have run this,
class ChangeDataTypeForReviews < ActiveRecord::Migration
def self.up
change_table :reviews do |t|
t.change :comments, :text
end
end
def self.down
change_table :reviews do |t|
t.change :comments, :string
end
end
end
after executing,
class CreateReviews < ActiveRecord::Migration
def change
create_table :reviews do |t|
t.string :artist
t.string :comments
t.timestamps
end
end
end
So, the latest change will be reflected in the corresponding table. It will not change anything in the previously created migration file. I.e., why we call it as Migration
, right?
So, no need to change t.string :comments
, because with the latest migration, we did change the datatype to text
. So, it will always be interpreted as a text type
field only.
Go through the docs properly.
Hope it helps :)