class RemoveLegacyColumnsFromRules < ActiveRecord::Migration[8.1]
  def change
    # Remove indexes first
    remove_index :rules, name: "index_rules_on_action" if index_exists?(:rules, name: "index_rules_on_action")
    remove_index :rules, name: "index_rules_on_rule_type" if index_exists?(:rules, name: "index_rules_on_rule_type")
    remove_index :rules, name: "idx_rules_type_enabled" if index_exists?(:rules, name: "idx_rules_type_enabled")

    # Remove the legacy columns
    remove_column :rules, :action, :string
    remove_column :rules, :rule_type, :string
  end
end
