diff --git a/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb b/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb index 49a842496..516ac371c 100644 --- a/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +++ b/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb @@ -330,6 +330,8 @@ def add_index_options(table_name, column_name, comment: nil, **options) # :nodoc # Remove the given index from the table. # Gives warning if index does not exist def remove_index(table_name, column_name = nil, **options) # :nodoc: + return if options[:if_exists] && !index_exists?(table_name, column_name, **options) + index_name = index_name_for_remove(table_name, column_name, options) # TODO: It should execute only when index_type == "UNIQUE" execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{quote_column_name(index_name)}" rescue nil