Module: ActiveRecord::ConnectionAdapters::ColumnMethods

Extended by:
ActiveSupport::Concern, ClassMethods
Included in:
Table, TableDefinition
Defined in:
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

Instance Method Summary collapse

Methods included from ActiveSupport::Concern

append_features, class_methods, extended, included, prepend_features, prepended

Instance Method Details

#bigintObject

:method: column :call-seq: column(name, type, **options)

Appends a column or columns of a specified type.

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

See TableDefinition#column



338
339
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 338

define_column_methods :bigint, :binary, :boolean, :date, :datetime, :decimal,
:float, :integer, :json, :string, :text, :time, :timestamp, :virtual

#primary_key(name, type = :primary_key, **options) ⇒ Object

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



323
324
325
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 323

def primary_key(name, type = :primary_key, **options)
  column(name, type, **options, primary_key: true)
end