instance method
primary_key
Ruby on Rails 5.1.7
Since v5.0.7.2 Last seen in v5.1.7Available in: v5.0.7.2 v5.1.7
Signature
primary_key(name, type = :primary_key, **options)
No documentation comment.
Parameters
-
namereq -
typeopt = :primary_key -
optionskeyrest
Source
# File activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb, line 5
def primary_key(name, type = :primary_key, **options)
options[:auto_increment] = true if [:integer, :bigint].include?(type) && !options.key?(:default)
super
end
Defined in activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb line 5
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::MySQL::ColumnMethods