方法
- C
- P
实例公共方法
column(name, type, **options) 链接
源代码: 显示 | 在 GitHub 上查看
# 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
primary_key(name, type = :primary_key, **options) 链接
将主键定义追加到表定义。可以多次调用,但这不是一个好主意。
源代码: 显示 | 在 GitHub 上查看
# 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