the bulk insert was returning empty array, so switch to selecting the newly inserted row before more bulk inserts

This commit is contained in:
Gavin Mogan 2020-04-17 23:09:39 -07:00
parent 357fdd99dc
commit c864afaf4f

View File

@ -18,7 +18,9 @@ export default {
licensePath: "/licenses/cc_by-nc_4.0.txt",
}
]))
.then(packId => {
.then(() => queryInterface.rawSelect('dimension_sticker_packs', { where: { name: "Loading Artist" } }, ['id']))
.then(packIds => {
const packId = Array.isArray(packIds) ? packIds[0] : packIds;
return queryInterface.bulkInsert("dimension_stickers", [
{
packId: packId,
@ -446,4 +448,4 @@ export default {
down: (_queryInterface: QueryInterface) => {
throw new Error("there is no going back");
}
}
}