34 lines
961 B
JavaScript
34 lines
961 B
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
up: async (queryInterface) => {
|
|
const count = 1000000;
|
|
const chunkSize = 10000;
|
|
|
|
for (let i = 0; i < count; i += chunkSize) {
|
|
const users = Array.from(
|
|
{ length: Math.min(chunkSize, count - i) },
|
|
() => ({
|
|
firstName:
|
|
'Firstname_' +
|
|
(Math.floor(Math.random() * 9_000_000_000) + 1_000_000_000),
|
|
lastName:
|
|
'Lastname_' +
|
|
(Math.floor(Math.random() * 9_000_000_000) + 1_000_000_000),
|
|
birthday: '2006-11-19 19:00:00.000 +00:00',
|
|
sex: Math.floor(Math.random() * 2) + 1,
|
|
problems: Math.random() < 0.5,
|
|
createdAt: '2006-11-19 19:00:00.000 +00:00',
|
|
updatedAt: '2006-11-19 19:00:00.000 +00:00',
|
|
}),
|
|
);
|
|
|
|
await queryInterface.bulkInsert('user', users, {});
|
|
}
|
|
},
|
|
|
|
down: async (queryInterface) => {
|
|
await queryInterface.bulkDelete('user', null, {});
|
|
},
|
|
};
|