class TableDefinition
Ruby on Rails 7.1.6
Since v2.2.3Active Record Connection Adapters Table Definition
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[7.1]
def up
create_table :foo do |t|
puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"
end
end
def down
...
end
end
Inherits from
Includes
Attributes
- ActiveRecord::ConnectionAdapters::TableDefinition#as
- ActiveRecord::ConnectionAdapters::TableDefinition#check_constraints
- ActiveRecord::ConnectionAdapters::TableDefinition#comment
- ActiveRecord::ConnectionAdapters::TableDefinition#foreign_keys
- ActiveRecord::ConnectionAdapters::TableDefinition#if_not_exists
- ActiveRecord::ConnectionAdapters::TableDefinition#indexes
- ActiveRecord::ConnectionAdapters::TableDefinition#name
- ActiveRecord::ConnectionAdapters::TableDefinition#options
- ActiveRecord::ConnectionAdapters::TableDefinition#temporary
Methods (defined here)
- # []
- # belongs_to
- # check_constraint
- # column
- # columns
- # foreign_key
- # index
- # references
- # remove_column
- # set_primary_key
- # timestamps
- self. new
Private methods
(6)
Implementation detail — not part of the public API.
Used by
Subclasses (3)
Methods (inherited)
From Object (17)
- # acts_like?
- # blank?
- # deep_dup
- # duplicable?
- # html_safe?
- # in?
- # instance_values
- # instance_variable_names
- # presence
- # presence_in
- # present?
- # to_param
- # to_query
- # try
- # try!
- # with
- # with_options
From ActiveSupport::Concern (3)
- # class_methods
- # included
- # prepended