class TableDefinition
Ruby on Rails 4.2.9
Represents the schema of an SQL table in an abstract way. This class provides methods for manipulating the schema representation.
Inside migration files, the t object in create_table is actually of this type:
class SomeMigration < ActiveRecord::Migration
def up
create_table :foo do |t|
puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"
end
end
def down
...
end
end
The table definitions The Columns are stored as a ColumnDefinition in the columns attribute.
Inherits from
Attributes
- ActiveRecord::ConnectionAdapters::TableDefinition#as
- ActiveRecord::ConnectionAdapters::TableDefinition#foreign_keys
- ActiveRecord::ConnectionAdapters::TableDefinition#indexes
- ActiveRecord::ConnectionAdapters::TableDefinition#name
- ActiveRecord::ConnectionAdapters::TableDefinition#options
- ActiveRecord::ConnectionAdapters::TableDefinition#temporary
Methods (defined here)
- # []
- # belongs_to
- # column
- # columns
- # index
- # primary_key
- # references
- # remove_column
- # timestamps
- self. new
Private methods (3)
Show private methods Implementation detail — not part of the public API.
Used by
Subclasses (1)
Methods (inherited)
From Object
(23)
- # <
- # acts_like?
- # blank?
- # create_fixtures
- # deep_dup
- # destroy
- # duplicable?
- # html_safe?
- # in?
- # instance_values
- # instance_variable_names
- # itself
- # perform
- # presence
- # presence_in
- # present?
- # to_param
- # to_query
- # try
- # try!
- # unescape
- # with_options
- self. table_name_prefix