include: option on add_index does nothing
Closed this issue · 3 comments
The adapter seems to be able to derive included columns on an index during schema generation, but the add_index method "include:" option seems to do nothing. The adapter reports that it supports includes, but seems to only partially support it...
repro:
`class CreateSomeTable < ActiveRecord::Migration[8.0]
def change
create_table :some_table do |t|
t.varchar :field1, limit: 50
t.varchar :field2, limit: 50
t.varchar :field3, limit: 73
t.timestamps
end
add_index :some_table, [ :field1, :field2], unique: true, include: :field3
end
end`
created a unique index on field1 and field2, but does not include field3
'INDEX INCLUDE' has been added to v8.1 of the adapter in #1301
It's not available in v8.0 so I'm not sure why the "adapter reports that it supports includes". Could you clarify?
Best way to clarify is to recreate the issue with a bug script. https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/How-to-report-a-bug
I was specifically looking at this code from main:
If main is your 8.1 branch, then that may be my confusion.
Ah - I see it is. Apologies...