| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- "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, {});
- */
- }
- };
|