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

Slash in indexes fails. acts-as-taggable-on #81

Open emilkarl opened 7 years ago

emilkarl commented 7 years ago

Tried this with an app that uses acts-as-taggable-on. A reccomended index looks like this but this fails with Rails 4. Any idea how to solve or should the index not be there?

add_index :taggings, [:acts_as_taggable_on/tag_id, :user_id]

plentz commented 7 years ago

@emilkarl that's a good question. can you provide a failing case with this or at least the model relevant info?

jethroo commented 6 years ago

have this in 3 models with association using class_name happens for has_many and belongs_to (not limited just seeing this for those two in my codebase)

class Corge < ActiveRecord::Base
  has_many   :foo_bars, class_name: Bar::Foo.name
  belongs_to :baz, class_name: Qux::Quux.name
end

results in:

add_index :corges, [:corge_id, :bar/foo_id]
add_index :corges, [:corge_id, :qux/quux_id]
plentz commented 6 years ago

@emilkarl @jethroo @SirRawlins @dandrews @olivierbuffon @matthewford which exact version of rails 4 are you using? I'm trying to reproduce it without success.

PS: if someone want to try to create a test case, it will be super helpfull.

taleh007 commented 6 years ago

@plentz

the same result

add_index :spree_shipments, [:spree/adjustment_id, :spree/order_id]
sobrinho commented 5 years ago

I will make a PR for that.

emilkarl commented 5 years ago

Close this?

ericraio commented 5 years ago

Close this?

Is there a PR for this, still needing this fix