WMS_MAIN/database/migrations/archive/20260405002000-add-expire-time-to-wms-file.js

27 lines
722 B
JavaScript

'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
const [ columns ] = await queryInterface.sequelize.query("SHOW COLUMNS FROM `wms_file` LIKE 'expire_time'");
if (columns.length > 0) {
return;
}
await queryInterface.addColumn('wms_file', 'expire_time', {
type: Sequelize.DATE,
allowNull: true,
defaultValue: null,
comment: '过期时间,为空表示永不过期',
});
},
async down(queryInterface) {
const [ columns ] = await queryInterface.sequelize.query("SHOW COLUMNS FROM `wms_file` LIKE 'expire_time'");
if (columns.length === 0) {
return;
}
await queryInterface.removeColumn('wms_file', 'expire_time');
},
};