方法
- B
- C
- D
- E
- H
- I
- J
- L
- M
- N
- O
- P
- S
- T
- U
- X
实例公共方法
bigserial(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 46
bit(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 50
bit_varying(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 54
box(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 126
cidr(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 58
circle(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 138
citext(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 62
daterange(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 66
enum(*names, **options) 链接
来源: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 173 define_column_methods :bigserial, :bit, :bit_varying, :cidr, :citext, :daterange, :hstore, :inet, :interval, :int4range, :int8range, :jsonb, :ltree, :macaddr, :money, :numrange, :oid, :point, :line, :lseg, :box, :path, :polygon, :circle, :serial, :tsrange, :tstzrange, :tsvector, :uuid, :xml, :timestamptz, :enum
hstore(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 70
inet(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 74
int4range(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 82
int8range(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 86
interval(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 78
jsonb(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 90
line(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 118
lseg(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 122
ltree(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 94
macaddr(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 98
money(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 102
numrange(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 106
oid(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 110
path(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 130
point(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 114
polygon(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 134
primary_key(name, type = :primary_key, **options) 链接
定义主键字段。支持使用 PostgreSQL 的原生 UUID 类型,可以通过如下方式定义表:
create_table :stuffs, id: :uuid do |t| t.string :content t.timestamps end
默认情况下,这将使用 gen_random_uuid() 函数。
要使用不带任何默认值的主键 UUID,请将 :default 选项设置为 nil。
create_table :stuffs, id: false do |t| t.primary_key :id, :uuid, default: nil t.uuid :foo_id t.timestamps end
您也可以传递一个返回 UUID 的自定义存储过程,或使用其他库的 UUID 生成函数。
请注意,将 UUID 主键的默认值设置为 nil 将要求您在保存记录之前始终确保提供一个 UUID 值(因为主键不能为 nil)。例如,这可以通过 SecureRandom.uuid 方法和 before_save 回调来实现。
来源: 显示 | 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 37 def primary_key(name, type = :primary_key, **options) if type == :uuid options[:default] = options.fetch(:default, "gen_random_uuid()") end super end
serial(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 142
timestamptz(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 166
tsrange(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 146
tstzrange(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 150
tsvector(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 154
uuid(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 158
xml(*names, **options) 链接
来源: 在 GitHub 上
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 162