WMS_MAIN/app/model/stock_unit.js

50 lines
1.0 KiB
JavaScript
Raw Permalink 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.

// app/model/stock_unit.js
'use strict';
module.exports = app => {
const { BIGINT, STRING, INTEGER, DATE } = app.Sequelize;
const StockUnit = app.model.define('wms_stock_unit', {
id: {
type: INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '主键ID',
},
warehouse_id: {
type: BIGINT(20).UNSIGNED,
allowNull: true,
defaultValue: null,
comment: '仓库ID,NULL表示系统默认',
},
name: {
type: STRING(50),
allowNull: false,
comment: '单位名称',
},
created_at: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '创建时间',
},
}, {
tableName: 'wms_stock_unit',
timestamps: false,
comment: '库存单位表',
indexes: [
{
name: 'idx_warehouse_id',
fields: [ 'warehouse_id' ],
},
{
name: 'uk_name_warehouse',
unique: true,
fields: [ 'name', 'warehouse_id' ],
},
],
});
return StockUnit;
};