2009-12-16 46 views
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记录,以及作为帐户记录。

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

回答

0

如果使用具体继承,主表将始终为空。主表中的所有字段都复制到子表中,因此不需要写入主表。