class TableDefinition
Ruby on Rails 2.3.18
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 and change_table is actually of this type:
class SomeMigration < ActiveRecord::Migration
def self.up
create_table :foo do |t|
puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"
end
end
def self.down
...
end
end
The table definitions The Columns are stored as a ColumnDefinition in the columns attribute.
Inherits from
Attributes
Methods (defined here)
- # []
- # belongs_to
- # column
- # method_missing
- # primary_key
- # references
- # timestamps
- # to_sql
- # xml
- # xml_column_fallback
- self. new
Private methods (1)
Show private methods Implementation detail — not part of the public API.
- # native
Methods (inherited)
From Object
(37)
- # acts_like?
- # app
- # as_json
- # blank?
- # class_eval
- # create
- # create_fixtures
- # destroy
- # duplicable?
- # edit
- # find_cmd
- # helper
- # html_safe?
- # index
- # instance_exec
- # instance_variable_defined?
- # instance_variable_names
- # message
- # metaclass
- # new_session
- # presence
- # present?
- # reload!
- # returning
- # singleton_class
- # tap
- # to_json
- # to_param
- # to_query
- # try
- # unescape
- # update
- # with_options
- self. blank_slate_method_added
- self. find_hidden_method
- self. lookup_missing_generator
- self. method_added