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

Bug with lol_dba cli option parsing #110

Closed zainosaurus closed 4 years ago

zainosaurus commented 5 years ago

Using the command lol_dba:find_indexes on the command line results in the following error trace:

Traceback (most recent call last):
        6: from /usr/local/bundle/bin/lol_dba:23:in `<main>'
        5: from /usr/local/bundle/bin/lol_dba:23:in `load'
        4: from /usr/local/bundle/gems/lol_dba-2.1.8/bin/lol_dba:10:in `<top (required)>'
        3: from /usr/local/bundle/gems/lol_dba-2.1.8/lib/lol_dba/cli.rb:8:in `start'
        2: from /usr/local/bundle/gems/lol_dba-2.1.8/lib/lol_dba/cli.rb:31:in `start'
        1: from /usr/local/bundle/gems/lol_dba-2.1.8/lib/lol_dba/cli.rb:35:in `rescue in start'
/usr/local/bundle/gems/lol_dba-2.1.8/lib/lol_dba/cli.rb:35:in `[]': no implicit conversion of Symbol into Integer (TypeError)

Upon further investigation, it seems that the @options variable in the LolDba::CLI class is not being populated correctly. On line 35 in the rescue clause the @options variable is an array (not a hash like is expected)

zainosaurus commented 5 years ago

I found the issue, the options hash is not returned from the parse_options method, which is causing this error.

I created a pull request related to this issue.

tilsammans commented 4 years ago

@plentz any change this fix is merged and a new version published?

plentz commented 4 years ago

Sorry for taking so long guys. Should be fixed in v2.1.9