0

I have a field in the PostgreSQL database in rails which has field type string. I want to convert it into text field. I am running rails migration to change the field type. Is there any care that I should take? will this cause loss of data?

class ChangeNotesToBeTextInSlots < ActiveRecord::Migration[5.1]
  def change
      change_column :slots, :notes, :text
  end
end
code0079
  • 147
  • 3
  • 13
  • 1
    Can you please update your question with the relevant code snippets please? I'd like to see the database schema file in this instance. This is for future readers of the question, so they can also benefit from the knowledge given. Do that and I'll answer. – Patrick Quigley Feb 17 '20 at 12:28
  • In ActiveRecord the `:string` type is an abstraction that usually equals a `varchar(255)` column. There are very few potential issues in changing the type of a varchar to text as its really just more of the same thing. – max Feb 17 '20 at 13:04

0 Answers0