const aspects = require('../generated/prescore_matrix.json') exports.seed = function (knex) { // Deletes ALL existing entries return knex('aspect_labels') .truncate() .then(function () { let rowCount = 1 const rows = [] Object.keys(aspects).forEach(label => { if(label != '_config') { const row = { aspect_id: rowCount } const ab = label.split('-') row.a = parseInt(ab[0]) row.b = parseInt(ab[1]) rows.push(row) rowCount++ } }) // Inserts seed entries return knex('aspect_labels').insert(rows) }) }