plentz / 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.
1.59k stars 69 forks source link

Output incorrectly reporting missing indexes (sort of) #83

Closed chmurph2 closed 7 years ago

chmurph2 commented 7 years ago

After migrating some indexes that were reported missing by this gem, I ran it again, and while I was expecting this:

Yey, no missing indexes found!

I got this output instead:

* TIP: if you have a problem with the index name('index name too long') you can solve with the :name option. Something like :name => 'my_index'.
* run `rails g migration AddMissingIndexes` and add the following content:

    class AddMissingIndexes < ActiveRecord::Migration
      def change

      end
    end

This is because this line that checks for empty indexes/keys isn't actually empty at that point. It's only later that those indexes in question are skipped here.

I will open a PR to fix this problem.

plentz commented 7 years ago

fixed @ 2.1.2