Repository: rails/rails
File: activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb (Ruby)

Code before:
        # :method: longtext
        # :call-seq: longtext(*names, **options)

        ##
        # :method: unsigned_integer
        # :call-seq: unsigned_integer(*names, **options)

        ##
        # :method: unsigned_bigint
        # :call-seq: unsigned_bigint(*names, **options)

        define_column_methods :blob, :tinyblob, :mediumblob, :longblob,
          :tinytext, :mediumtext, :longtext, :unsigned_integer, :unsigned_bigint,
          :unsigned_float, :unsigned_decimal

        deprecate :unsigned_float, :unsigned_decimal, deprecator: ActiveRecord.deprecator
      end

      # = Active Record MySQL Adapter \Index Definition
      class IndexDefinition < ActiveRecord::ConnectionAdapters::IndexDefinition
        attr_reader :enabled

        def initialize(*args, **kwargs)
          @enabled = kwargs.delete(:enabled)
          super
          @enabled = enabled.nil? ? true : enabled
        end

        def enabled=(value)
          return if value.nil?

          @enabled = value
        end

        def defined_for?(columns = nil, name: nil, unique: nil, valid: nil, include: nil, nulls_not_distinct: nil, enabled: nil, **options)
          super(columns, name:, unique:, valid:, include:, nulls_not_distinct:, **options) &&
            (enabled.nil? || self.enabled == enabled)
        end

        def disabled?
          !@enabled
        end
      end

      # = Active Record MySQL Adapter \Table Definition
      class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
        include ColumnMethods

        attr_reader :charset, :collation

        def initialize(conn, name, charset: nil, collation: nil, **)

Review comment (suggestion):
I think we could express this in one line like this:
```suggestion
          @enabled = kwargs.key?(:enabled) ? kwargs.delete(:enabled) : true
          super
```

Code after:
        # :method: longtext
        # :call-seq: longtext(*names, **options)

        ##
        # :method: unsigned_integer
        # :call-seq: unsigned_integer(*names, **options)

        ##
        # :method: unsigned_bigint
        # :call-seq: unsigned_bigint(*names, **options)

        define_column_methods :blob, :tinyblob, :mediumblob, :longblob,
          :tinytext, :mediumtext, :longtext, :unsigned_integer, :unsigned_bigint,
          :unsigned_float, :unsigned_decimal

        deprecate :unsigned_float, :unsigned_decimal, deprecator: ActiveRecord.deprecator
      end

      # = Active Record MySQL Adapter \Index Definition
      class IndexDefinition < ActiveRecord::ConnectionAdapters::IndexDefinition
        attr_accessor :enabled

        def initialize(*args, **kwargs)
          @enabled = kwargs.key?(:enabled) ? kwargs.delete(:enabled) : true
          super
        end

        def defined_for?(columns = nil, name: nil, unique: nil, valid: nil, include: nil, nulls_not_distinct: nil, enabled: nil, **options)
          super(columns, name:, unique:, valid:, include:, nulls_not_distinct:, **options) &&
            (enabled.nil? || self.enabled == enabled)
        end

        def disabled?
          !@enabled
        end
      end

      # = Active Record MySQL Adapter \Table Definition
      class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
        include ColumnMethods

        attr_reader :charset, :collation

        def initialize(conn, name, charset: nil, collation: nil, **)
          super
          @charset = charset
          @collation = collation
        end

        def new_column_definition(name, type, **options) # :nodoc:
          case type