63 lines
1000 B
JavaScript
63 lines
1000 B
JavaScript
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
const Employees = db.employees;
|
|
|
|
const EmployeesData = [
|
|
{
|
|
first_name: 'John',
|
|
|
|
last_name: 'Doe',
|
|
|
|
email: 'john.doe@example.com',
|
|
|
|
job_title: 'Software Engineer',
|
|
},
|
|
|
|
{
|
|
first_name: 'Jane',
|
|
|
|
last_name: 'Smith',
|
|
|
|
email: 'jane.smith@example.com',
|
|
|
|
job_title: 'Product Manager',
|
|
},
|
|
|
|
{
|
|
first_name: 'Emily',
|
|
|
|
last_name: 'Johnson',
|
|
|
|
email: 'emily.johnson@example.com',
|
|
|
|
job_title: 'HR Specialist',
|
|
},
|
|
|
|
{
|
|
first_name: 'Michael',
|
|
|
|
last_name: 'Brown',
|
|
|
|
email: 'michael.brown@example.com',
|
|
|
|
job_title: 'Sales Executive',
|
|
},
|
|
];
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
await Employees.bulkCreate(EmployeesData);
|
|
|
|
await Promise.all([
|
|
// Similar logic for "relation_many"
|
|
]);
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
await queryInterface.bulkDelete('employees', null, {});
|
|
},
|
|
};
|