2016-04-08 8 views
0

「Waterlineはあなたのモデルを見て、2つのモデルがお互いを指し示すコレクション属性を持っていることが分かったら、それは自動的に構築されますあなたのための結合テーブル。私はデシベルと私のモデルのルックスとしてMySQLを使用していますwhere句SAILS:関連テーブルmysql many-manyを定義する方法

で私の質問私は今、エラーを取得していますとの対応表である表を知る喫水線する方法である

unknow列NaNこのような:

Sells.js:

module.exports = { 
    autoCreatedAt: true, 
    autoUpdatedAt: false, 
    attributes: { 
    createdAt:{ 
     type:'datetime', 
     columnName:'created' 
    }, 
    qty_sold:{ 
     type:'float' 
    }, 
    s_notes:{ 
     type:'string' 
    }, 
    items: { 
     collection: 'species', 
     via: 'sales', 
     dominant:true 
    } 
    } 
}; 

Species.js:

module.exports = { 
    autoCreatedAt: false, 
    autoUpdatedAt: false, 
    attributes: { 
    name:{ 
     type:'string',  
    }, 
    qty:{ 
     type:'float', 
    }, 
    sort:{ 
     type:'float', 
    }, 
    quickbooks_listid:{ 
     type:'string' 
    }, 
    quickbooks_editsequence:{ 
     type:'string' 
    }, 
    isEdited:{ 
     type:'integer' 
    }, 
    cut_fish:{ 
     type:'integer' 
    }, 
    // Add a reference to Sells 
    sales: { 
     collection: 'sells', 
     via: 'items', 
     //dominant: true 
    } 
    } 

};

そして私は、MySQL DBで2つの既存のテーブルがあります。 種と

答えて

0

売る販売している:

id: { 
    type: 'integer', 
    primaryKey: true, 
    autoIncrement: true 
}, 

species:{ 
    collection: "species", // match model name here 
    via: "Sells", // match attribute name on other model 
    dominant: true // dominant side 
} 

Species.js:

id: { 
    type: 'integer', 
    primaryKey: true, 
    autoIncrement: true 
}, 

sells:{ 
    collection: "Sells", // match model name 
    via: "Species" // match attribute name 
} 
関連する問題