2014-11-01 178 views
0

我想從另一個表中爲模型拉額外的屬性。 我一直在嘗試與關聯,但它似乎是錯誤的創建一個額外的模型,並將其關聯到我的原始模型。Sails.js從另一個表中添加屬性到一個模型

這是我的模型Company.js

module.exports = { 
    schema: true, 
    autoCreatedAt: false, 
    autoUpdatedAt: false, 
    autoPK: false, 

    attributes: { 
     name: { 
      type: 'string' 
     }, 
     url: { 
      type: 'string' 
     }, 
     summary: { 
      type: 'text' 
     } 
    } 
}; 

我在MySQL的另一個表有兩列,crunchbase_url和COMPANY_ID,我想給crunchbase_url拉進公司的模式,這將是最好的方式在不遷移數據庫的情況下做到這一點(不幸的是,不是一種選擇)。

感謝,

回答

相關問題