'use strict'; const { generateSalt, hashPassword } = require('../../app/lib/password'); const USERNAME = 'admin'; const DEFAULT_PASSWORD = 'admin123'; /** 初始化超级管理员账号,登录后请及时修改密码 */ module.exports = { async up(queryInterface) { const salt = generateSalt(); const now = new Date(); await queryInterface.bulkInsert('users', [ { username: USERNAME, password: hashPassword(DEFAULT_PASSWORD, salt), salt, nickname: '超级管理员', status: 1, created_at: now, updated_at: now, }, ], {}); }, async down(queryInterface) { await queryInterface.bulkDelete('users', { username: USERNAME }, {}); }, };