1

我有以下数据库结构:

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 记录以及一个 Account 记录。

我是否误解了继承/我是否在滥用它,或者我做错了什么?

4

1 回答 1

0

如果您使用具体继承,主表将始终为空。主表中的所有字段都在子表中重复。因此无需写入主表。

于 2009-12-17T14:39:02.507 回答