005-features.js 495 B

12345678910111213141516171819
  1. "use strict";
  2. const faker = require("faker");
  3. const { seedValue, features } = require("../src/config/seeders");
  4. const TABLE_NAME = "sl_features";
  5. module.exports = {
  6. up: async (queryInterface, Sequelize) => {
  7. faker.seed(seedValue);
  8. const data = features.map((name, index) => ({ id: index + 1, name }));
  9. await queryInterface.bulkInsert(TABLE_NAME, data, {});
  10. },
  11. down: async (queryInterface, Sequelize) => {
  12. await queryInterface.bulkDelete(TABLE_NAME, null, {});
  13. },
  14. };