I recently started noticing that following a deployment to production, I see this git diff in my db/schema.rb
there:
- t.boolean "published", limit: 1
+ t.boolean "published"
and
- t.boolean "visible", limit: 1, default: false
+ t.boolean "visible", default: false
Given that the Rails version is the same on both environments, is this just caused by the difference between MySQL versions, respectively 5.5.43 on production and 5.6.23 on development?
Has your Rails version changed? There was a recent change in Rails that could account for this: https://github.com/rails/rails/pull/19066
Basically, since MySQL doesn't have a boolean column type, Rails uses a TINYINT(1)
column type for :boolean
attributes, which was reflected when the schema was dumped to schema.rb
. So far, so good. But then if one tried to load the same schema.rb
into PostgreSQL it would fail because Postgres does have a BOOLEAN
column type, but declaring a length for BOOLEAN
columns is illegal. This bug was fixed by removing the limit: 1
option when dumping :boolean
attributes from a MySQL database (it wasn't necessary anyway).
So if the last time your schema was dumped (which happens when you run migrations) you were on Rails 4.2.2 or earlier you would have gotten limit: 1
in schema.rb
, and if you subsequently upgraded to 4.2.3 and dumped your schema again the limit: 1
would be gone.
This change doesn't have any effect except for fixing the aforementioned bug—your schema.rb
will function exactly the same way it did before—so there's nothing to be concerned about.