Repository: rails/rails
File: activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb (Ruby)

Code before:
      #
      # ====== Creating an index with a specific algorithm
      #
      #  add_index(:developers, :name, algorithm: :concurrently)
      #  # CREATE INDEX CONCURRENTLY developers_on_name on developers (name) -- PostgreSQL
      #
      #  add_index(:developers, :name, algorithm: :inplace)
      #  # CREATE INDEX `index_developers_on_name` ON `developers` (`name`) ALGORITHM = INPLACE -- MySQL
      #
      # Note: only supported by PostgreSQL and MySQL.
      #
      # Concurrently adding an index is not supported in a transaction.
      #
      # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration].
      #
      # ====== Creating an index that is not used by queries
      #
      #   add_index(:developers, :name, enabled: false)
      #
      # generates:
      #
      #   CREATE INDEX index_developers_on_name ON developers (name) INVISIBLE -- MySQL
      #
      #   CREATE INDEX index_developers_on_name ON developers (name) IGNORED -- MariaDB
      #
      # Note: only supported by MySQL version 8.0.0 >= and MariaDB version 10.6.0 >=.
      #
      def add_index(table_name, column_name, **options)
        create_index = build_create_index_definition(table_name, column_name, **options)
        execute schema_creation.accept(create_index)
      end

      # Builds a CreateIndexDefinition object.
      #
      # This definition object contains information about the index that would be created
      # if the same arguments were passed to #add_index. See #add_index for information about
      # passing a +table_name+, +column_name+, and other additional options that can be passed.
      def build_create_index_definition(table_name, column_name, **options) # :nodoc:
        index, algorithm, if_not_exists = add_index_options(table_name, column_name, **options)
        CreateIndexDefinition.new(index, algorithm, if_not_exists)
      end

      # Removes the given index from the table.
      #
      # Removes the index on +branch_id+ in the +accounts+ table if exactly one such index exists.
      #
      #   remove_index :accounts, :branch_id
      #
      # Removes the index on +branch_id+ in the +accounts+ table if exactly one such index exists.
      #
      #   remove_index :accounts, column: :branch_id

Review comment (suggestion):
Nit, I find the `>=` notation like this a bit confusing to read without anything on the RHS.
```suggestion
      # Note: only supported by MySQL version 8.0.0 and greater, and MariaDB version 10.6.0 and greater.
```

Code after:
      #
      # ====== Creating an index with a specific algorithm
      #
      #  add_index(:developers, :name, algorithm: :concurrently)
      #  # CREATE INDEX CONCURRENTLY developers_on_name on developers (name) -- PostgreSQL
      #
      #  add_index(:developers, :name, algorithm: :inplace)
      #  # CREATE INDEX `index_developers_on_name` ON `developers` (`name`) ALGORITHM = INPLACE -- MySQL
      #
      # Note: only supported by PostgreSQL and MySQL.
      #
      # Concurrently adding an index is not supported in a transaction.
      #
      # For more information see the {"Transactional Migrations" section}[rdoc-ref:Migration].
      #
      # ====== Creating an index that is not used by queries
      #
      #   add_index(:developers, :name, enabled: false)
      #
      # generates:
      #
      #   CREATE INDEX index_developers_on_name ON developers (name) INVISIBLE -- MySQL
      #
      #   CREATE INDEX index_developers_on_name ON developers (name) IGNORED -- MariaDB
      #
      # Note: only supported by MySQL version 8.0.0 and greater, and MariaDB version 10.6.0 and greater.
      #
      def add_index(table_name, column_name, **options)
        create_index = build_create_index_definition(table_name, column_name, **options)
        execute schema_creation.accept(create_index)
      end

      # Builds a CreateIndexDefinition object.
      #
      # This definition object contains information about the index that would be created
      # if the same arguments were passed to #add_index. See #add_index for information about
      # passing a +table_name+, +column_name+, and other additional options that can be passed.
      def build_create_index_definition(table_name, column_name, **options) # :nodoc:
        index, algorithm, if_not_exists = add_index_options(table_name, column_name, **options)
        CreateIndexDefinition.new(index, algorithm, if_not_exists)
      end

      # Removes the given index from the table.
      #
      # Removes the index on +branch_id+ in the +accounts+ table if exactly one such index exists.
      #
      #   remove_index :accounts, :branch_id
      #
      # Removes the index on +branch_id+ in the +accounts+ table if exactly one such index exists.
      #
      #   remove_index :accounts, column: :branch_id