class TableDefinition
Ruby on Rails 7.0.10
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.0]
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
- # timestamps
- self. new
Private methods (5)
Show private methods Implementation detail — not part of the public API.
Used by
Subclasses (3)
Methods (inherited)
From ActiveRecord::ConnectionAdapters::ColumnMethods
(2)
- # column
- # primary_key
From Object
(16)
- # 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_options
From ActiveRecord::TestFixtures
(4)
From ActiveSupport::Concern
(3)
- # class_methods
- # included
- # prepended