'use strict'; module.exports = app => { const { STRING, INTEGER, BIGINT, DATE } = app.Sequelize; const InboxNumberRule = app.model.define('inboxNumberRule', { id: { type: BIGINT(20).UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键', }, name: { type: STRING(100), allowNull: false, comment: '规则名称,如:运单号提取/收货单号提取/平台订单号提取', }, target: { type: STRING(50), allowNull: false, comment: '提取目标类型:waybill_no/receiving_no/entry_order_no/stockout_no/order_no/source_order_codes/express_name/plate_no', }, regexp: { type: STRING(500), allowNull: false, comment: '取号正则(JS 正则源字符串,不含首尾斜杠,支持全局匹配)', }, sort_order: { type: INTEGER(11), allowNull: false, defaultValue: 0, comment: '规则尝试顺序,数值小者优先', }, created_at: { type: DATE, comment: '创建时间', }, updated_at: { type: DATE, comment: '更新时间', }, }, { tableName: 'wms_inbox_number_rule', underscored: true, timestamps: true, createdAt: 'created_at', updatedAt: 'updated_at', paranoid: false, comment: '取号规则表(站内信消息中正则提取单据号)', indexes: [ { unique: true, fields: [ 'name' ], name: 'uk_name', }, { fields: [ 'target' ], name: 'idx_target', }, ], }); return InboxNumberRule; };