"use strict"; const bcrypt = require("bcrypt"); const saltRounds = 10; const names = ["林", "李", "郭", "鄭", "楊", "黃", "陳", "連", "周", "何"]; async function getUserData(name) { const password = await bcrypt.hashSync("test", saltRounds); return { password, name, permission: 1 }; } module.exports = { up: async (queryInterface, Sequelize) => { const getUserPromises = Array.from(Array(10).keys()).map(index => getUserData(names[index]) ); const users = await Promise.all(getUserPromises); return queryInterface.bulkInsert("users", users); /* Add altering commands here. Return a promise to correctly handle asynchronicity. Example: return queryInterface.bulkInsert('People', [{ name: 'John Doe', isBetaMember: false }], {}); */ }, down: (queryInterface, Sequelize) => { /* Add reverting commands here. Return a promise to correctly handle asynchronicity. Example: return queryInterface.bulkDelete('People', null, {}); */ } };