Sha256: cbbfc3caa361d8ea683cf74e44148581abf8541fcde386ecdd728a8459e5631c

Contents?: true

Size: 903 Bytes

Versions: 5

Compression:

Stored size: 903 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module SQLServer
      class SchemaDumper < ConnectionAdapters::SchemaDumper
        SQLSEVER_NO_LIMIT_TYPES = [
          "text",
          "ntext",
          "varchar(max)",
          "nvarchar(max)",
          "varbinary(max)"
        ].freeze

        private

        def explicit_primary_key_default?(column)
          column.is_primary? && !column.is_identity?
        end

        def schema_limit(column)
          return if SQLSEVER_NO_LIMIT_TYPES.include?(column.sql_type)

          super
        end

        def schema_collation(column)
          return unless column.collation

          column.collation if column.collation != @connection.collation
        end

        def default_primary_key?(column)
          super && column.is_primary? && column.is_identity?
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-6.0.3 lib/active_record/connection_adapters/sqlserver/schema_dumper.rb
activerecord-sqlserver-adapter-6.0.2 lib/active_record/connection_adapters/sqlserver/schema_dumper.rb
activerecord-sqlserver-adapter-6.0.1 lib/active_record/connection_adapters/sqlserver/schema_dumper.rb
activerecord-sqlserver-adapter-6.0.0 lib/active_record/connection_adapters/sqlserver/schema_dumper.rb
activerecord-sqlserver-adapter-6.0.0.rc2 lib/active_record/connection_adapters/sqlserver/schema_dumper.rb