I want to change a column type from :string
to :text
The problem is that if I simply do:
change_column :questions, :content, :text
Then the schema is rewritten to:
t.string "content", :limit => 255
i.e. it takes the length that was implicit whe开发者_JAVA百科n it was a string
How can I do the migration and specify that the :limit
should not be set such that the schema reads:
t.string "content"
I have tried setting an arbitrary limit of 10,000 but a) that feels inefficient and b) it makes the down migration attempt to set the :text
limit to 10,000.
What option can I pass to the change_column
method to ensure it simply uses the default limit?
Ack, discovered this by trial and error moments after posting the question:
change_column :questions, :content, :text, :limit => nil
精彩评论