开发者

Heroku migration: type modifier is not allowed for type "bytea"

I'm running some migrations on Heroku and I'm getting this issue. I have this line in one of my migrations to create a new table:

t.binary :file, :limit => 10.megabytes

Heroku is giving me this PostgreSQL error:

An error has occurred, this and all later migrations canceled:

PGError: ERROR:  type modifier is not allowed for type "bytea"
LINE 1: ..."file" bytea(10485760)...
                                                         ^
: CREATE TABL开发者_运维百科E "files" ("id" serial primary key, "file" bytea(10485760), "created_at" timestamp, "updated_at" timestamp) 

How can I change my migration so it plays nice with both MySQL and Postgre?


From Heroku's docs:

Binary field limit

Cause: PostgreSQL doesn’t limit binary fields. Any migrations adding a :binary field with the :limit option will raise a syntax error.

Solution: Omit the :limit for binary fields if possible — or test the DB before running it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜