学说的继承不插入记录到父表
-
19-09-2019 - |
题
我已经得到下面的数据库结构:
Account:
columns:
email: string(255)
name:
type: string(255)
UserRegistered:
columns:
email:
type: string(255)
email: true
notnull: true
unique: true
username:
type: string(255)
notnull: true
nospace: true
unique: true
minlength: 5
password:
type: string(255)
token: string(255)
inheritance:
extends: Account
type: concrete
UserOpenid:
columns:
openid: string(255)
openid_provider: string(255)
inheritance:
extends: Account
type: concrete
当我插入一个新的UserRegistered或UserOpenid纪录,我会一直期待它来创建一个UserRegistered记录,以及帐户记录。
我误解继承/我会滥用它,还是我做错了什么?
解决方案
如果您使用的具体继承主表会一直是空的。所有从主表中的字段被复制在子表..因此没有必要写到主表中。
不隶属于 StackOverflow