Class: ActiveRecord::ConnectionAdapters::MySQL::TableDefinition
- Inherits:
-
TableDefinition
- Object
- TableDefinition
- ActiveRecord::ConnectionAdapters::MySQL::TableDefinition
- Includes:
- ColumnMethods
- Defined in:
- lib/active_record/connection_adapters/mysql/schema_definitions.rb
Instance Attribute Summary collapse
-
#charset ⇒ Object
readonly
Returns the value of attribute charset.
-
#collation ⇒ Object
readonly
Returns the value of attribute collation.
Attributes inherited from TableDefinition
#as, #check_constraints, #comment, #foreign_keys, #if_not_exists, #indexes, #name, #options, #temporary
Instance Method Summary collapse
-
#initialize(conn, name, charset: nil, collation: nil) ⇒ TableDefinition
constructor
A new instance of TableDefinition.
-
#new_column_definition(name, type, **options) ⇒ Object
:nodoc:.
Methods inherited from TableDefinition
#[], #check_constraint, #column, #columns, #foreign_key, #index, #new_check_constraint_definition, #new_foreign_key_definition, #primary_keys, #references, #remove_column, #timestamps
Methods included from ColumnMethods
Constructor Details
#initialize(conn, name, charset: nil, collation: nil) ⇒ TableDefinition
Returns a new instance of TableDefinition.
65 66 67 68 69 |
# File 'lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 65 def initialize(conn, name, charset: nil, collation: nil, **) super @charset = charset @collation = collation end |
Instance Attribute Details
#charset ⇒ Object (readonly)
Returns the value of attribute charset.
63 64 65 |
# File 'lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 63 def charset @charset end |
#collation ⇒ Object (readonly)
Returns the value of attribute collation.
63 64 65 |
# File 'lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 63 def collation @collation end |
Instance Method Details
#new_column_definition(name, type, **options) ⇒ Object
:nodoc:
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 71 def new_column_definition(name, type, **) # :nodoc: case type when :virtual type = [:type] when :primary_key type = :integer [:limit] ||= 8 [:primary_key] = true when /\Aunsigned_(?<type>.+)\z/ type = $~[:type].to_sym [:unsigned] = true end super end |