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 TABLE "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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With