rentease-backend/models/Region.js

44 lines
934 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.

const { DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const Region = sequelize.define('Region', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
comment: '区域ID'
},
name: {
type: DataTypes.STRING(50),
allowNull: false,
unique: true,
comment: '区域名称'
},
description: {
type: DataTypes.TEXT,
allowNull: true,
comment: '区域描述'
},
createTime: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updateTime: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
onUpdate: DataTypes.NOW,
comment: '更新时间'
},
isDeleted: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
comment: '删除状态0未删除1已删除'
}
}, {
tableName: 'regions',
timestamps: false
});
module.exports = Region;