From 32f87d251e7150573fe3a9c2336ea75815246224 Mon Sep 17 00:00:00 2001 From: Tim Diggins Date: Mon, 8 Jan 2024 12:19:32 +0000 Subject: [PATCH] stop exception when index is exotic and columns is a string --- lib/lol_dba/index_finding/index_finder.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/lol_dba/index_finding/index_finder.rb b/lib/lol_dba/index_finding/index_finder.rb index a9c9f78..669f249 100644 --- a/lib/lol_dba/index_finding/index_finder.rb +++ b/lib/lol_dba/index_finding/index_finder.rb @@ -58,7 +58,12 @@ def self.existing_indexes(table_name) def self.table_indexes(table_name) indexes = ActiveRecord::Base.connection.indexes(table_name.to_sym) indexes.collect do |index| - index.columns.size > 1 ? index.columns.sort : index.columns.first + if index.columns.is_a?(String) + # eg. gin, tsvector... + index.columns + else + index.columns.size > 1 ? index.columns.sort : index.columns.first + end end end