Sha256: dbc0cdb7fbefccafc59ee95e7f84753c70a8bb9b48676e60133f7ad234eb5f4c

Contents?: true

Size: 636 Bytes

Versions: 13

Compression:

Stored size: 636 Bytes

Contents

module ActiveRecord
  module ConnectionAdapters
    module Sqlserver
      class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
        def uuid(name, options = {})
          column(name, 'uniqueidentifier', options)
        end

        def primary_key(name, type = :primary_key, options = {})
          return super unless type == :uuid
          options[:default] = options.fetch(:default, 'NEWID()')
          options[:primary_key] = true
          column name, type, options
        end

        def column(name, type = nil, options = {})
          super
          self
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-4.1.8 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.0.4 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.1.7 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.0.3 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.1.6 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.0.2 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.1.5 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.1.4 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.0.1 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.1.2 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.1.1 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.1.0 lib/active_record/connection_adapters/sqlserver/table_definition.rb
activerecord-sqlserver-adapter-4.0.0 lib/active_record/connection_adapters/sqlserver/table_definition.rb