28 lines
776 B
JavaScript
28 lines
776 B
JavaScript
'use strict';
|
|
const bcrypt = require('bcrypt');
|
|
|
|
/** @type {import('sequelize-cli').Migration} */
|
|
module.exports = {
|
|
async up (queryInterface, Sequelize) {
|
|
// 관리자 계정 비밀번호 해시 생성
|
|
const salt = await bcrypt.genSalt(10);
|
|
const hashedPassword = await bcrypt.hash('Dlrwns0304#', salt);
|
|
|
|
// 관리자 계정 생성
|
|
await queryInterface.bulkInsert('users', [{
|
|
name: '관리자',
|
|
email: 'master@jaybe.dev',
|
|
password: hashedPassword,
|
|
role: 'admin',
|
|
status: 'active',
|
|
createdAt: new Date(),
|
|
updatedAt: new Date()
|
|
}], {});
|
|
},
|
|
|
|
async down (queryInterface, Sequelize) {
|
|
// 관리자 계정 삭제
|
|
await queryInterface.bulkDelete('users', { email: 'master@jaybe.dev' }, {});
|
|
}
|
|
};
|