Class: ActiveRecord::ConnectionAdapters::MySQL::TableDefinition
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
|
|
| Inherits: |
ActiveRecord::ConnectionAdapters::TableDefinition
|
| Defined in: | activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb |
Overview
Active Record MySQL Adapter Table Definition
Class Method Summary
Instance Attribute Summary
- #charset readonly
- #collation readonly
::ActiveRecord::ConnectionAdapters::TableDefinition - Inherited
Instance Method Summary
- #aliased_types(name, fallback) private
- #integer_like_primary_key_type(type, options) private
- #valid_column_definition_options private
- #new_column_definition(name, type, **options) Internal use only
ColumnMethods - Included
| #blob, #longblob, #longtext, #mediumblob, #mediumtext, #tinyblob, #tinytext, #unsigned_bigint, #unsigned_integer |
::ActiveRecord::ConnectionAdapters::TableDefinition - Inherited
| #[] | Returns a |
| #belongs_to | Alias for TableDefinition#references. |
| #check_constraint, | |
| #column | Instantiates a new column for the table. |
| #columns | Returns an array of |
| #foreign_key, | |
| #index | Adds index options to the indexes hash, keyed by column name This is primarily used to track indexes that need to be created after the table. |
| #references | Adds a reference. |
| #remove_column | remove the column |
| #set_primary_key, | |
| #timestamps | Appends |
| #aliased_types, #create_column_definition, #integer_like_primary_key?, #integer_like_primary_key_type, #raise_on_duplicate_column, #valid_column_definition_options, #new_check_constraint_definition, #new_column_definition, #new_foreign_key_definition, #primary_keys | |
::ActiveRecord::ConnectionAdapters::ColumnMethods - Included
| #blob, #numeric, | |
| #primary_key | Appends a primary key definition to the table definition. |
Constructor Details
.new(conn, name, charset: nil, collation: nil) ⇒ TableDefinition
Instance Attribute Details
#charset (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 73
attr_reader :charset, :collation
#collation (readonly)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 73
attr_reader :charset, :collation
Instance Method Details
#aliased_types(name, fallback) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 102
def aliased_types(name, fallback) fallback end
#integer_like_primary_key_type(type, options) (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 106
def integer_like_primary_key_type(type, ) unless [:auto_increment] == false [:auto_increment] = true end type end
#new_column_definition(name, type, **options)
This method is for internal use only.
[ GitHub ]
# File 'activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 81
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
#valid_column_definition_options (private)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb', line 98
def super + [:auto_increment, :charset, :as, :size, :unsigned, :first, :after, :type, :stored] end