WMS_MAIN/database/migrations/20260622110000-add-space-id-to-wms-inbound-direct-log.js
liufumingren 77435aeb79 1
2026-06-23 18:48:33 +08:00

26 lines
776 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
const TABLE_NAME = 'wms_inbound_direct_log';
module.exports = {
up: async (queryInterface, Sequelize) => {
const tables = await queryInterface.showAllTables();
const exists = tables.some(t => (typeof t === 'string' ? t : t.tableName) === TABLE_NAME);
if (!exists) return;
const columns = await queryInterface.describeTable(TABLE_NAME);
if (columns.space_id) return;
await queryInterface.addColumn(TABLE_NAME, 'space_id', {
type: Sequelize.BIGINT(20).UNSIGNED,
allowNull: true,
defaultValue: null,
comment: '存放库位ID,关联 wms_location_space.id;为空时 commit 默认使用 1',
});
},
down: async queryInterface => {
await queryInterface.removeColumn(TABLE_NAME, 'space_id');
},
};