-
Notifications
You must be signed in to change notification settings - Fork 564
Closed
Description
I started use of adapter and from first days enabled
lowercase_schema_reflection = true
But I faced with a bug in primary keys and proposed fix ##639
After several days of development I mentioned indexes case became uppercase again in schema.
I think mistakes are here:
def indexes(table_name, name = nil)
data = select("EXEC sp_helpindex #{quote(table_name)}", name) rescue []
data.reduce([]) do |indexes, index|
index = index.with_indifferent_access
if index[:index_description] =~ /primary key/
indexes
else
name = index[:index_name]
unique = index[:index_description] =~ /unique/
where = select_value("SELECT [filter_definition] FROM sys.indexes WHERE name = #{quote(name)}")
columns = index[:index_keys].split(',').map do |column|
column.strip!
column.gsub! '(-)', '' if column.ends_with?('(-)')
column
end
indexes << IndexDefinition.new(table_name, name, unique, columns, nil, nil, where)
end
end
end
Variables "name" and "column" should respect lowercase_schema_reflection. But they did not.
What I think, it worth to note in documentation, that lowercase_schema_reflection is rather experimental.
Finally I turned off lowercase_schema_reflection in my code...