synt_backend
Version:
Synt light-weight node backend service
31 lines (28 loc) • 854 B
JavaScript
module.exports = {
up: async (queryInterface, Sequelize) => {
const UserIds = await queryInterface.sequelize.query(
"SELECT id FROM Users",
{ type: Sequelize.QueryTypes.SELECT }
);
const NotificationSettingIds = await queryInterface.sequelize.query(
"SELECT id FROM NotificationSettings",
{ type: Sequelize.QueryTypes.SELECT }
);
let bulk = [];
UserIds.forEach((a) => {
NotificationSettingIds.forEach((b) => {
bulk.push({
UserId: a.id,
NotificationSettingId: b.id,
createdAt: new Date(),
updatedAt: new Date(),
});
});
});
await queryInterface.bulkInsert("NotificationSettingUser", bulk);
},
down: async (queryInterface) => {
await queryInterface.bulkDelete("NotificationSettingUser", null, {});
},
};
;