Class: ActiveRecord::ConnectionAdapters::TableDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract/schema_definitions.rb,
lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract/schema_definitions.rb

Instance Method Summary collapse

Instance Method Details

#column(name, type, options = {}) ⇒ Object



19
20
21
22
23
24
# File 'lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract/schema_definitions.rb', line 19

def column(name, type, options = {})
  column_without_unsigned(name, type, options)
  column = self[name]
  column.unsigned = options[:unsigned]
  self
end

#column_without_unsignedObject



18
# File 'lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract/schema_definitions.rb', line 18

alias_method :column_without_unsigned, :column

#new_column_definition(name, type, options) ⇒ Object



15
16
17
18
19
# File 'lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract/schema_definitions.rb', line 15

def new_column_definition(name, type, options)
  column = new_column_definition_without_unsigned(name, type, options)
  column.unsigned = options[:unsigned]
  column
end

#new_column_definition_without_unsignedObject



14
# File 'lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract/schema_definitions.rb', line 14

alias_method :new_column_definition_without_unsigned, :new_column_definition

#primary_key(name, type = :primary_key, options = {}) ⇒ Object



14
15
16
# File 'lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract/schema_definitions.rb', line 14

def primary_key(name, type = :primary_key, options = {})
  column(name, type, options.merge(primary_key: true).reverse_merge(unsigned: true))
end