<commit_before>module ActiveRecord
  module ConnectionAdapters
    class PostgreSQLAdapter::SchemaCreation < ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation
      def add_column_options_with_spatial!(sql, options)
        column = options.fetch(:column) { return super }
        if column.type == :geometry && column.srid && column.spatial_type
          sql << "(#{column.spatial_type},#{column.srid})"
        else
          add_column_options_without_spatial!(sql, options)
        end
      end

      alias_method_chain :add_column_options!, :spatial
    end

    module SchemaStatements
      # Adds a spatial column to the table using the PostGIS
      # "AddGeometryColumn()" function.
      #
      # This method exists for backwards compatability with PostGIS 1.x.
      #
      # Example:
      #   add_geometry_column :roads, :geom, srid: 423, type: 'LINESTRING', dimension: 2
      #
      def add_geometry_column(table_name, column_name, options = {})
        execute "SELECT AddGeometryColumn('#{table_name}', '#{column_name}', '#{options[:srid]}', '#{options[:type]}', '#{options[:dimension]}')"
      end
    end
  end
end<commit_msg>Changed type option for add_geometry_column to spatial_type.<commit_after>module ActiveRecord
  module ConnectionAdapters
    class PostgreSQLAdapter::SchemaCreation < ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation
      def add_column_options_with_spatial!(sql, options)
        column = options.fetch(:column) { return super }
        if column.type == :geometry && column.srid && column.spatial_type
          sql << "(#{column.spatial_type},#{column.srid})"
        else
          add_column_options_without_spatial!(sql, options)
        end
      end

      alias_method_chain :add_column_options!, :spatial
    end

    module SchemaStatements
      # Adds a spatial column to the table using the PostGIS
      # "AddGeometryColumn()" function.
      #
      # This method exists for backwards compatability with PostGIS 1.x.
      #
      # Example:
      #   add_geometry_column :roads, :geom, srid: 423, spatial_type: 'LINESTRING', dimension: 2
      #
      def add_geometry_column(table_name, column_name, options = {})
        execute "SELECT AddGeometryColumn('#{table_name}', '#{column_name}', '#{options[:srid]}', '#{options[:spatial_type]}', '#{options[:dimension]}')"
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11037067888379842, 'fraction_numerical': 0.004164931278633903, 'mean_word_length': 3.448148148148148, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3407479', 'n_tokens_mistral': 709, 'n_tokens_neox': 677, 'n_words': 161}