Class: ActiveRecord::Mysql::Awesome::TableDefinition
- Inherits:
-
ConnectionAdapters::TableDefinition
- Object
- ConnectionAdapters::TableDefinition
- ActiveRecord::Mysql::Awesome::TableDefinition
- Includes:
- ColumnMethods
- Defined in:
- lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb
Instance Method Summary collapse
-
#initialize(types, name, temporary, options, as = nil) ⇒ TableDefinition
constructor
A new instance of TableDefinition.
- #new_column_definition(name, type, options) ⇒ Object
Methods included from ColumnMethods
#primary_key, #unsigned_integer
Constructor Details
#initialize(types, name, temporary, options, as = nil) ⇒ TableDefinition
Returns a new instance of TableDefinition.
27 28 29 30 |
# File 'lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb', line 27 def initialize(types, name, temporary, , as = nil) super(types, name, temporary, ) @as = as end |
Instance Method Details
#new_column_definition(name, type, options) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb', line 32 def new_column_definition(name, type, ) column = super case column.type when :primary_key column.type = :integer column.auto_increment = true when :unsigned_integer column.type = :integer column.unsigned = true end column.auto_increment ||= [:auto_increment] column.unsigned ||= [:unsigned] column.charset = [:charset] column.collation = [:collation] column end |