开发者

Rails migrate date to string?

开发者 https://www.devze.com 2022-12-30 14:03 出处:网络
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?

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

精彩评论

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