33 lines
921 B
JavaScript
33 lines
921 B
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
async up(queryInterface) {
|
|
const [ columns ] = await queryInterface.sequelize.query("SHOW COLUMNS FROM `wms_store` LIKE 'subject_config'");
|
|
if (columns.length === 0) {
|
|
return;
|
|
}
|
|
|
|
await queryInterface.sequelize.query(`
|
|
UPDATE wms_store
|
|
SET subject_config = JSON_INSERT(
|
|
COALESCE(subject_config, JSON_OBJECT()),
|
|
'$.default_express_code', 'STO',
|
|
'$.default_platform_code', 'TB'
|
|
)
|
|
`);
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
const [ columns ] = await queryInterface.sequelize.query("SHOW COLUMNS FROM `wms_store` LIKE 'subject_config'");
|
|
if (columns.length === 0) {
|
|
return;
|
|
}
|
|
|
|
await queryInterface.sequelize.query(`
|
|
UPDATE wms_store
|
|
SET subject_config = JSON_REMOVE(subject_config, '$.default_express_code', '$.default_platform_code')
|
|
WHERE subject_config IS NOT NULL
|
|
`);
|
|
},
|
|
};
|