rails/rails — pull request #5173 by kennyj (2012-02-25 15:50:19+00:00)
Title: [Try again] Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931.

The original issue is #3931.

First, add the following line.

```
t.text :example, :limit => 0x555555 (5592405) # `mediumtext`
```

Second, migrate and be generated schema.rb. I'll see

```
t.text "example", :limit => 16777215 # `longtext` !
```

I think that the cause of problem is mysql behavior difference by character encoding.

If we use latin1 encoding, the limit is 16777215.
But if we use utf-8 encoding, the limit is 16777215 / 3 = 5592405.

Thus, I should fix `binary_fields` test, because I guess that we usually use utf-8 encoding.

Please see also #3931 and #4382.

Closes #3931.