20250225034424-article.js 592 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. /** @type {import('sequelize-cli').Migration} */
  3. module.exports = {
  4. async up (queryInterface, Sequelize) {
  5. const articles = [];
  6. const counts = 10;
  7. for(let i = 1; i<= counts;i++){
  8. const article = {
  9. title:`文章的标题${i}`,
  10. content:`文章的内容${i}`,
  11. createdAt:new Date(),
  12. updatedAt:new Date()
  13. }
  14. articles.push(article)
  15. }
  16. await queryInterface.bulkInsert('Articles',articles,{})
  17. },
  18. async down (queryInterface, Sequelize) {
  19. await queryInterface.bulkDelete('Articles', null, {});
  20. }
  21. };