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

Code before:

      def new_check_constraint_definition(expression, options) # :nodoc:
        options = @conn.check_constraint_options(name, expression, options)
        CheckConstraintDefinition.new(name, expression, options)
      end

      private
        def create_column_definition(name, type, options)
          ColumnDefinition.new(name, type, options)
        end

        def aliased_types(name, fallback)
          "timestamp" == name ? :datetime : fallback
        end

        def integer_like_primary_key?(type, options)
          options[:primary_key] && [:integer, :bigint].include?(type) && !options.key?(:default)
        end

        def integer_like_primary_key_type(type, options)
          type
        end
    end

    class AlterTable # :nodoc:
      attr_reader :adds
      attr_reader :foreign_key_adds, :foreign_key_drops
      attr_reader :check_constraint_adds, :check_constraint_drops

      def initialize(td)
        @td   = td
        @adds = []
        @foreign_key_adds = []
        @foreign_key_drops = []
        @check_constraint_adds = []
        @check_constraint_drops = []
      end

      def name; @td.name; end

      def add_foreign_key(to_table, options)
        @foreign_key_adds << @td.new_foreign_key_definition(to_table, options)
      end

      def drop_foreign_key(name)
        @foreign_key_drops << name
      end

      def add_check_constraint(expression, options)
        @check_constraint_adds << @td.new_check_constraint_definition(expression, options)
      end

Review comment (suggestion):
```suggestion
            options.assert_valid_keys(:_uses_legacy_reference_index_name, :_skip_validate_options_keys, valid_column_definition_option_keys)
```

Code after:

        options[:primary_key] ||= type == :primary_key
        options[:null] = false if options[:primary_key]
        create_column_definition(name, type, options)
      end

      def new_foreign_key_definition(to_table, options) # :nodoc:
        prefix = ActiveRecord::Base.table_name_prefix
        suffix = ActiveRecord::Base.table_name_suffix
        to_table = "#{prefix}#{to_table}#{suffix}"
        options = @conn.foreign_key_options(name, to_table, options)
        ForeignKeyDefinition.new(name, to_table, options)
      end

      def new_check_constraint_definition(expression, options) # :nodoc:
        options = @conn.check_constraint_options(name, expression, options)
        CheckConstraintDefinition.new(name, expression, options)
      end

      private
        def valid_column_definition_options
          ColumnDefinition::OPTION_NAMES
        end

        def create_column_definition(name, type, options)
          unless options[:_skip_validate_options]
            options.except(:_uses_legacy_reference_index_name, :_skip_validate_options).assert_valid_keys(valid_column_definition_options)
          end

          ColumnDefinition.new(name, type, options)
        end

        def aliased_types(name, fallback)
          "timestamp" == name ? :datetime : fallback
        end

        def integer_like_primary_key?(type, options)
          options[:primary_key] && [:integer, :bigint].include?(type) && !options.key?(:default)
        end

        def integer_like_primary_key_type(type, options)
          type
        end
    end

    class AlterTable # :nodoc:
      attr_reader :adds
      attr_reader :foreign_key_adds, :foreign_key_drops
      attr_reader :check_constraint_adds, :check_constraint_drops

      def initialize(td)