我已经得到下面的数据库结构:

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记录,以及帐户记录。

我误解继承/我会滥用它,还是我做错了什么?

有帮助吗?

解决方案

如果您使用的具体继承主表会一直是空的。所有从主表中的字段被复制在子表..因此没有必要写到主表中。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top