'use strict'; /** * 续期订单补「套餐」快照 * * 订单要记下当时买的哪个套餐(id / code / name),套餐后续改价或下架都不影响历史订单对账。 */ module.exports = { async up(queryInterface, Sequelize) { const { BIGINT, STRING } = Sequelize; await queryInterface.addColumn('subject_orders', 'plan_id', { type: BIGINT.UNSIGNED, allowNull: true, comment: '续期套餐 subject_plans.id(内部/手工单可能为空)', after: 'user_id', }); await queryInterface.addColumn('subject_orders', 'plan_code', { type: STRING(32), allowNull: true, comment: '套餐编码快照', after: 'plan_id', }); await queryInterface.addColumn('subject_orders', 'plan_name', { type: STRING(64), allowNull: true, comment: '套餐名称快照', after: 'plan_code', }); }, async down(queryInterface) { await queryInterface.removeColumn('subject_orders', 'plan_id'); await queryInterface.removeColumn('subject_orders', 'plan_code'); await queryInterface.removeColumn('subject_orders', 'plan_name'); }, };