Class: ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract_adapter.rb

Instance Method Summary collapse

Instance Method Details

#type_to_sql(type, limit, precision, scale, unsigned) ⇒ Object



21
22
23
# File 'lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract_adapter.rb', line 21

def type_to_sql(type, limit, precision, scale, unsigned)
  @conn.type_to_sql type.to_sym, limit, precision, scale, unsigned
end

#visit_AddColumn(o) ⇒ Object



8
9
10
11
12
# File 'lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract_adapter.rb', line 8

def visit_AddColumn(o)
  sql_type = type_to_sql(o.type.to_sym, o.limit, o.precision, o.scale, o.unsigned)
  sql = "ADD #{quote_column_name(o.name)} #{sql_type}"
  add_column_options!(sql, column_options(o))
end

#visit_ColumnDefinition(o) ⇒ Object



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

def visit_ColumnDefinition(o)
  sql_type = type_to_sql(o.type.to_sym, o.limit, o.precision, o.scale, o.unsigned)
  column_sql = "#{quote_column_name(o.name)} #{sql_type}"
  add_column_options!(column_sql, column_options(o)) unless o.primary_key?
  column_sql
end