20250227064224-add-article-to-table.js 829 B

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. /** @type {import('sequelize-cli').Migration} */
  3. module.exports = {
  4. async up (queryInterface, Sequelize) {
  5. await queryInterface.addColumn('Articles', 'type', {
  6. type: Sequelize.INTEGER,
  7. allowNull: true, // 根据需要设置是否允许为空
  8. });
  9. await queryInterface.addColumn('Articles', 'img', {
  10. type: Sequelize.TEXT,
  11. allowNull: true, // 根据需要设置是否允许为空
  12. });
  13. await queryInterface.addColumn('Articles', 'date', {
  14. type: Sequelize.DATE,
  15. allowNull: true, // 根据需要设置是否允许为空
  16. });
  17. },
  18. async down (queryInterface, Sequelize) {
  19. await queryInterface.removeColumn('Articles', 'type');
  20. await queryInterface.removeColumn('Articles', 'img');
  21. await queryInterface.removeColumn('Articles', 'date');
  22. }
  23. };