1
私は今knexを学んでおり、2つの異なるテーブルのID番号を後で結合テーブルとして使用される空のテーブルに動的に挿入しようとしています。knexを使用して結合テーブルを動的に作成
これは私がこれまで行ってきたことですが、私は現時点では基本的に離れていると感じています。
exports.seed = function(knex, Promise) {
return knex('future_join_table').del()
.then(function() {
return Promise.all([
// Inserts seed entries
knex('future_join_table').insert({
first_id: knex('table1').select('id'),
second_id: knex('table2').select('id')
})
]);
});
};