Methods
Instance Public methods
column(name, type, **options)
Appends a column or columns of a specified type.
t.string(:goat)
t.string(:goat, :sheep)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 319
included do
define_column_methods :bigint, :binary, :boolean, :date, :datetime, :decimal,
:float, :integer, :json, :string, :text, :time, :timestamp, :virtual
alias :blob :binary
alias :numeric :decimal
end
🔎 See on GitHub
primary_key(name, type = :primary_key, **options)
Appends a primary key definition to the table definition. Can be called multiple times, but this is probably not a good idea.
📝 Source code
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 304
def primary_key(name, type = :primary_key, **options)
column(name, type, **options.merge(primary_key: true))
end
🔎 See on GitHub