I have the following Rails Migration:
class ChangeCommentLength < ActiveRecord::Migration
def up
change_column :videos, :comment, :string, limit: 500
end
def down
change_column :videos, :comment, :string, limit: 255
end
end
However, when I run this, I get the following error message:
PG::Error: ERROR: cannot alter type of a column used by a view or rule
DETAIL: rule _RETURN on -view- depends on column "comment"
Attempting to run the sql directly:
ALTER TABLE "videos" ALTER COLUMN "comment" TYPE character varying(500);
ERROR: cannot alter type of a column used by a view or rule
DETAIL: rule _RETURN on view -view- depends on column "comment"
I understand why this would usually be a problem (can't go modifying datatypes underneath existing views). However, how can I work around this given that I am not changing the column type, just the column limit?