rails/rails — Issue #3338: Add support to specify column collation when working with columns in SQLite
Author: bitaxis
Created: 2011-10-15 15:07:56+00:00
State: open

By default, SQLite uses BINARY collation on columns, which is in effect case-sensitive for string columns. I would like to have the option to use a different collation, such as NOCASE, which emulates case-insensitivity to a degree. However, this feature can be (and has been) extended to support other collations.

For example, I would like to be able to do something like this in my migrations:

```ruby
class CreatePeople < ActiveRecord::Migration
def change
create_table :people do |t|
t.string :name, :null => false, :collate => "nocase" # case-insensitive for ASCII characters
t.integer :age, :null => false, # binary collation
t.timestamps
end
end
end
```

Other places where the ```:collate``` option can be supported are in the ```change_column()``` method and the ActiveRecord finders.