Skip to content

Commit

Permalink
Fix remove_index for older Rails versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Dec 12, 2023
1 parent 29664c9 commit f1e2223
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class ChangeFlipperGatesValueToText < ActiveRecord::Migration<%= migration_versi
# Ensure this incremental update migration is idempotent
return unless connection.column_exists? :flipper_gates, :value, :string

if index_exists? :flipper_gates, [:feature_key, :key, :value], unique: true
remove_index :flipper_gates, [:feature_key, :key, :value], unique: true
if index_exists? :flipper_gates, [:feature_key, :key, :value]
remove_index :flipper_gates, [:feature_key, :key, :value]
end
change_column :flipper_gates, :value, :text
add_index :flipper_gates, [:feature_key, :key, :value], unique: true, length: { value: 255 }
Expand Down

0 comments on commit f1e2223

Please sign in to comment.