58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 微信用户须知版本表模型(副表)。
|
||
* 提交一次自动新增版本:version 为数字、同一 appid 内自动 +1;拉取只取最新版本。
|
||
* @param {import('egg').Application} app Egg 应用实例。
|
||
* @return {import('sequelize').ModelCtor<import('sequelize').Model>} Sequelize 模型。
|
||
*/
|
||
module.exports = app => {
|
||
const { BIGINT, STRING, TEXT, DATE } = app.Sequelize;
|
||
|
||
const WechatAgreementVersion = app.model.define('wechatAgreementVersion', {
|
||
id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
primaryKey: true,
|
||
autoIncrement: true,
|
||
allowNull: false,
|
||
comment: '主键',
|
||
},
|
||
appid: {
|
||
type: STRING(64),
|
||
allowNull: false,
|
||
comment: '小程序AppID(关联 wms_wechat_app.appid)',
|
||
},
|
||
content: {
|
||
type: TEXT('long'),
|
||
allowNull: true,
|
||
defaultValue: null,
|
||
comment: '用户须知富文本内容',
|
||
},
|
||
created_at: {
|
||
type: DATE,
|
||
comment: '创建时间',
|
||
},
|
||
updated_at: {
|
||
type: DATE,
|
||
comment: '更新时间',
|
||
},
|
||
}, {
|
||
tableName: 'wms_wechat_agreement_version',
|
||
freezeTableName: true,
|
||
underscored: true,
|
||
timestamps: true,
|
||
createdAt: 'created_at',
|
||
updatedAt: 'updated_at',
|
||
paranoid: false,
|
||
comment: '微信用户须知版本表(副表,提交一次新增一个版本)',
|
||
indexes: [
|
||
{
|
||
fields: [ 'appid' ],
|
||
name: 'idx_appid',
|
||
},
|
||
],
|
||
});
|
||
|
||
return WechatAgreementVersion;
|
||
};
|