#lol_dba
lol_dba is a small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed. Also, it can generate .sql migration scripts. Most of the code come from rails_indexes and migration_sql_generator.
Add lol_dba to your Gemfile:
gem "lol_dba"
and install gem
bundle install
Display a migration for adding/removing all necessary indexes based on associations:
rake db:find_indexes
Generate .sql files for all your migrations inside db/migrate_sql folder:
rake db:migrate_sql
Note that create an index in a big database may take a long time.
Compatible with Ruby 1.9 and Rails 3.x. I think.
The primary key is always indexed. This is generally true for all storage engines that at all supports indices.
For this reason, no longer displays a gem suggestions about adding indexes to primary keys.
bundle install
rake
to run the tests.
All feedback, bug reports and thoughts on this gratefully received.
Lol DBA is released under the MIT license.