关联类型
- Belongs To 从属 一对一
- Has One 关联一对一
- Has Many 关联一对多
- Many To Many 关联多对多(有中间表)
- polymorphic 多态关联
关联标签说明
| 标签名 | 标签说明 |
|---|---|
| foreignKey | 指定当前表与中间表关联的字段,默认为当前表的主键字段 |
| joinForeignKey | 指定中间表与当前表关联的字段,默认为当前表模型名加下划线连接主键字段 (均为蛇形名) |
| references | 指定关联表与中间表关联的字段, 默认为关联表的主键字段 |
| JoinReferences | 指定中间表与关联表关联的字段, 默认为关联表模型名 + "_" + 主键字段 (均为蛇形名) |
| many2many | 多对多关联中,指定中间表名或模型名 |
| polymorphic | 指定多态类型,比如模型名 |
| polymorphicValue | 指定多态值、默认表名 |
| constraint | 关系约束,例如:OnUpdate、OnDelete |
文档更新时间: 2021-08-15 21:57 作者:joker.liu