WMS_MAIN/database/migrations/20260923140000-drop-version-from-wechat-agreement-version.js

30 lines
891 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';
/**
* 用户须知版本表去掉 version 数字版本号,直接用 id 自增(2026-09-23):
* - 删除唯一索引 uk_appid_version(appid,version);
* - 删除 version 列;最新版本判定改为 ORDER BY id DESC。
*/
const TABLE_NAME = 'wms_wechat_agreement_version';
module.exports = {
async up(queryInterface) {
await queryInterface.removeIndex(TABLE_NAME, 'uk_appid_version');
await queryInterface.removeColumn(TABLE_NAME, 'version');
},
async down(queryInterface, Sequelize) {
await queryInterface.addColumn(TABLE_NAME, 'version', {
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: null,
comment: '协议版本号(数字,同一 appid 内自动+1)',
});
await queryInterface.addIndex(TABLE_NAME, [ 'appid', 'version' ], {
unique: true,
name: 'uk_appid_version',
});
},
};