Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fixed bug where enums limit were getting set as 0 #6432

wants to merge 1 commit into from

3 participants


This is an old bug where rake db:schema:dump imported all columns with the type enum as :limit => 0, making schema.rb don't work on with anything that relies on it(db:schema:load).

This issue were raised here:

And there's other posts on the web about it.

I solved it by setting the limit as the biggest enum value string size. I wonder if shouldn't we just set it as like 255 to only make it work.

I think it's also time that rails supports enum columns. There's plugins that do that, but I would gadly make it work.

Feel free to comment about the code or the regexp, I will also gadly change it.


@thiagofm how about the mysql2 adapted? Did you see any way to test this?


There are no tests... so I will write some tests for it then.

@senny senny added enum and removed enum labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 22, 2012
  1. @thiagofm
This page is out of date. Refresh to see the latest.
2  activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -67,6 +67,8 @@ def extract_limit(sql_type)
super # we could return 65535 here, but we leave it undecorated by default
+ when /^enum\((.*)\)/i
+ $1.split(',').collect{ |value| value.size-2 }.max
when /^bigint/i; 8
when /^int/i; 4
when /^mediumint/i; 3
Something went wrong with that request. Please try again.