Reputation: 3281
i get the error
PGError: ERROR: type modifier is not allowed for type "text"
LINE 1: ...ng(255), "desc" character varying(255), "content" text(255),...
when i do a heroku run rake db:reset
i understand that postgresql needs an unlimited type for 'text' and in my latest migration file i have...
class ChangeLessonsTable < ActiveRecord::Migration
def change
change_table :lessons do |t|
t.change :content, :text, :limit => nil
end
end
end
i still keep getting the error though. any ideas why? i ran rake db:reset, rake db:migrate, and git push to make sure my local db changed. then i ran git heroku push and heroku run rake db:reset but i keep getting that error. am i missing something? thanks
Upvotes: 0
Views: 1356
Reputation: 434755
You should be able to leave off the :limit
entirely:
class ChangeLessonsTable < ActiveRecord::Migration
def change
change_table :lessons do |t|
t.change :content, :text
end
end
end
If that doesn't work then you could try separate up and down actions:
def up
change_column :lessons, :content, :text
end
def down
change_column :lessons, :content, :string
end
As an aside, if you're targeting PostgreSQL you should just use :text
and forget about the :string
(AKA varchar
) column type, PostgreSQL treats them all the same internally. The only time you should bother with varchar/:string
is when your data integrity requires a specific upper limit on the string size.
Upvotes: 4