Skip to Content Skip to Search

module ActiveRecord::ConnectionAdapters::ColumnMethods

Public instance methods

Appends a column or columns of a specified type.

t.string(:goat)
t.string(:goat, :sheep)

See TableDefinition#column

Source code GitHub
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 334
define_column_methods :bigint, :binary, :boolean, :date, :datetime, :decimal,
  :float, :integer, :json, :string, :text, :time, :timestamp, :virtual

Appends a primary key definition to the table definition. Can be called multiple times, but this is probably not a good idea.

Source code GitHub
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 319
def primary_key(name, type = :primary_key, **options)
  column(name, type, **options, primary_key: true)
end

Definition files