You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.2 KiB
64 lines
1.2 KiB
const { DataTypes } = require("sequelize");
|
|
|
|
const seq = require("../db/seq");
|
|
|
|
const Environment = seq.define("chicken_environment", {
|
|
// id 会被sequelize自动创建, 管理
|
|
house_id: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
comment: "鸡舍id",
|
|
},
|
|
coop_id: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
unique: true,
|
|
comment: "鸡舍id",
|
|
},
|
|
temperature: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
comment: "温度",
|
|
},
|
|
humidity: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
comment: "湿度",
|
|
},
|
|
co2: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
comment: "co2",
|
|
},
|
|
nh3: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
comment: "nh3",
|
|
},
|
|
illumination: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
comment: "光照强度",
|
|
},
|
|
wind_speed: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
comment: "风速",
|
|
},
|
|
h2s: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
comment: "h2s",
|
|
},
|
|
log_time: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: DataTypes.NOW,
|
|
comment: "记录时间",
|
|
},
|
|
});
|
|
|
|
// 强制同步数据库(创建数据表)
|
|
// Environment.sync({ force: true });
|
|
|
|
module.exports = Environment;
|