开发者

Rails migrate date to string?

I have a field in my db table which is a date rather than string, how do I make a migration to convert it to a string?

class CreateKases < ActiveR开发者_运维知识库ecord::Migration
  def self.up
    create_table :kases do |t|
    t.date :dateclosed

Is it even possible?

Thanks,

Danny


You can change a column by using change_column.

def self.up
    change_column :kases, :dateclosed, :string
end

Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜