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

Code before:
        def create_table_definition(name, **options)
          TableDefinition.new(self, name, **options)
        end

        def create_alter_table(name)
          AlterTable.new create_table_definition(name)
        end

        def extract_table_options!(options)
          options.extract!(:temporary, :if_not_exists, :options, :as, :comment, :charset, :collation)
        end

        def fetch_type_metadata(sql_type)
          cast_type = lookup_cast_type(sql_type)
          SqlTypeMetadata.new(
            sql_type: sql_type,
            type: cast_type.type,
            limit: cast_type.limit,
            precision: cast_type.precision,
            scale: cast_type.scale,
          )
        end

        def index_column_names(column_names)
          if expression_column_name?(column_names)
            column_names
          else
            Array(column_names)
          end
        end

        def index_name_options(column_names)
          if expression_column_name?(column_names)
            column_names = column_names.scan(/\w+/).join("_")
          end

          { column: column_names }
        end

        # Try to identify whether the given column name is an expression
        def expression_column_name?(column_name)
          column_name.is_a?(String) && /\W/.match?(column_name)
        end

        def strip_table_name_prefix_and_suffix(table_name)
          prefix = Base.table_name_prefix
          suffix = Base.table_name_suffix
          table_name.to_s =~ /#{prefix}(.+)#{suffix}/ ? $1 : table_name.to_s
        end

        def foreign_key_name(table_name, options)

Review comment (suggestion):
```suggestion
            options.assert_valid_keys(VALID_INTERNAL_OPTIONS, valid_table_definition_option_keys, valid_primary_key_option_keys))
```

Code after:

        def create_table_definition(name, **options)
          TableDefinition.new(self, name, **options)
        end

        def create_alter_table(name)
          AlterTable.new create_table_definition(name)
        end

        def valid_table_definition_options
          [:temporary, :if_not_exists, :options, :as, :comment, :charset, :collation]
        end

        def valid_primary_key_options
          [:limit, :default, :precision]
        end

        def validate_create_table_options!(options)
          unless options[:_skip_validate_options]
            options
              .except(:_uses_legacy_table_name, :_skip_validate_options)
              .assert_valid_keys(valid_table_definition_options, valid_primary_key_options)
          end
        end

        def fetch_type_metadata(sql_type)
          cast_type = lookup_cast_type(sql_type)
          SqlTypeMetadata.new(
            sql_type: sql_type,
            type: cast_type.type,
            limit: cast_type.limit,
            precision: cast_type.precision,
            scale: cast_type.scale,
          )
        end

        def index_column_names(column_names)
          if expression_column_name?(column_names)
            column_names
          else
            Array(column_names)
          end
        end

        def index_name_options(column_names)
          if expression_column_name?(column_names)
            column_names = column_names.scan(/\w+/).join("_")
          end

          { column: column_names }
        end