2009-12-16 49 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

如果使用具體繼承,主表將始終爲空。主表中的所有字段都複製到子表中,因此不需要寫入主表。