public
Description: Rails plugin that allows to define index lengths in your migrations, through :limit parameter
Homepage: http://www.eparreno.com
Clone URL: git://github.com/eparreno/mysql_index_length.git
name age message
file MIT-LICENSE Tue May 26 00:39:20 -0700 2009 first commit [eparreno]
file README.rdoc Tue Sep 22 15:03:19 -0700 2009 Solved issue with add_index sentence in schema.... [eparreno]
file Rakefile Tue May 26 00:39:20 -0700 2009 first commit [eparreno]
file init.rb Tue May 26 00:39:20 -0700 2009 first commit [eparreno]
directory lib/ Tue Sep 22 15:03:19 -0700 2009 Solved issue with add_index sentence in schema.... [eparreno]
directory test/ Wed May 27 03:47:47 -0700 2009 more tests [eparreno]
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