Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
This feature has been included in Rails 2.3.6 - Rails plugin that allows to define index lengths in your migrations, through :limit parameter
Ruby
branch: master

Solved issue with add_index sentence in schema.rb, thanks to Paul Hor…

…sfall and Bernie Telles for your comments
latest commit 32589959a6
@eparreno authored

README.rdoc

Mysql Index Length

Defining an index length is a commong practice in order to avoid large data indexes, and improve performance. This plugin adds support for index lengths on the MySQL adapter. With this plugin, you can specify easily index lengths in your migrations.

Example

How to define index lengths in your migrations?

add_index(:accounts, :name, :limit => 10) generates CREATE INDEX by_name ON accounts(name(10))

add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :limit => 10) generates CREATE INDEX by_name_surname ON accounts(name(10), surname(10))

add_index(:accounts, [:name, :surname], :name => 'by_name_surname', :limit => {:name => 10, :surname => 20}) generates CREATE INDEX by_name_surname ON accounts(name(10), surname(20))

Note that :name parameter is optional.

How to test?

Create a MySQL database named mysql_index_length_plugin_test, go to vendor/plugins/mysql_index_length and run rake

Issues

Use the GitHub Issue Tracker github.com/eparreno/mysql_index_length/issues

Copyright © 2009 Emili Parreño - www.eparreno.com, released under the MIT license

Something went wrong with that request. Please try again.