'use strict'; /** * 店铺增加「最近拉取订单」状态,用于定时拉单判断间隔与前端展示。 * * - last_order_sync_at:最近一次成功发起拉单的时间(含手动与定时) * - last_order_sync_msg:最近一次拉单结果/失败原因 */ module.exports = { async up(queryInterface, Sequelize) { await queryInterface.addColumn('shops', 'last_order_sync_at', { type: Sequelize.DATE, allowNull: true, comment: '最近一次拉取订单时间', }); await queryInterface.addColumn('shops', 'last_order_sync_msg', { type: Sequelize.STRING(255), allowNull: true, comment: '最近一次拉取订单结果/失败原因', }); await queryInterface.addIndex('shops', [ 'type', 'auto_fetch_order' ], { name: 'idx_shops_type_auto_fetch' }); }, async down(queryInterface) { await queryInterface.removeIndex('shops', 'idx_shops_type_auto_fetch'); await queryInterface.removeColumn('shops', 'last_order_sync_msg'); await queryInterface.removeColumn('shops', 'last_order_sync_at'); }, };