WMS_MAIN/database/migrations/20260922100000-expand-login-code-length.js

31 lines
829 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';
/**
* 扩展 wms_user_oauth.login_code 长度:64 → 128。
*
* 原因:login_code 为 {uuid, id_6} JSON 的 base64,长度约 96 字符,
* 原 VARCHAR(64) 写入时报 Data too long。
*/
const TABLE_NAME = 'wms_user_oauth';
module.exports = {
async up(queryInterface, Sequelize) {
const { STRING } = Sequelize;
await queryInterface.changeColumn(TABLE_NAME, 'login_code', {
type: STRING(128),
allowNull: true,
comment: '登录码({uuid,id_6} JSON 的 base64,一次性消费)',
});
},
async down(queryInterface, Sequelize) {
const { STRING } = Sequelize;
await queryInterface.changeColumn(TABLE_NAME, 'login_code', {
type: STRING(64),
allowNull: true,
comment: '登录码(前缀+随机,64位,全局唯一)',
});
},
};