rentease-backend/models/Apartment.js

53 lines
1.1 KiB
JavaScript
Raw Normal View History

2026-03-02 12:36:41 +00:00
const { DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const Apartment = sequelize.define('Apartment', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
2026-03-05 15:26:13 +00:00
autoIncrement: true,
comment: '公寓ID'
2026-03-02 12:36:41 +00:00
},
name: {
type: DataTypes.STRING(50),
2026-03-05 15:26:13 +00:00
allowNull: false,
comment: '公寓名称'
2026-03-02 12:36:41 +00:00
},
address: {
type: DataTypes.STRING(255),
2026-03-05 15:26:13 +00:00
allowNull: true,
comment: '公寓地址'
2026-03-02 12:36:41 +00:00
},
2026-03-08 16:28:33 +00:00
createBy: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '创建人ID'
},
2026-03-02 12:36:41 +00:00
createTime: {
type: DataTypes.DATE,
2026-03-05 15:26:13 +00:00
defaultValue: DataTypes.NOW,
comment: '创建时间'
2026-03-03 15:36:48 +00:00
},
2026-03-08 16:28:33 +00:00
updateBy: {
type: DataTypes.INTEGER,
allowNull: true,
comment: '修改人ID'
},
2026-03-03 15:36:48 +00:00
updateTime: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
2026-03-05 15:26:13 +00:00
onUpdate: DataTypes.NOW,
comment: '更新时间'
2026-03-03 15:36:48 +00:00
},
isDeleted: {
type: DataTypes.INTEGER,
allowNull: false,
2026-03-05 15:26:13 +00:00
defaultValue: 0,
comment: '删除状态0未删除1已删除'
2026-03-02 12:36:41 +00:00
}
}, {
tableName: 'apartments',
timestamps: false
});
module.exports = Apartment;