Sha256: 669caaaaaf8e3b40e660a3581a1225b35ed383ac37d9e40e4a5739da8399390b
Contents?: true
Size: 1.44 KB
Versions: 15
Compression:
Stored size: 1.44 KB
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.type == :integer && !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 # use inspect to ensure collation is dumped as string. Without this it's dumped as # a constant ('collation: SQL_Latin1_General_CP1_CI_AS') collation = column.collation.inspect # use inspect to ensure string comparison default_collation = @connection.collation.inspect collation if collation != default_collation end def default_primary_key?(column) super && column.is_identity? end def schemas(stream) schema_names = @connection.schema_names if schema_names.any? schema_names.sort.each do |name| stream.puts " create_schema #{name.inspect}" end stream.puts end end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems