const { DataTypes } = require("sequelize"); const seq = require("../db/seq"); const Control = seq.define("chicken_control", { // id 会被sequelize自动创建, 管理 temperature_start: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "温度范围起始值温度", }, temperature_end: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "温度范围结束值温度", }, temperature_default_start: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "默认起始温度", }, temperature_default_end: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "默认结束温度", }, humidity_start: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "湿度范围起始值", }, humidity_end: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "湿度范围结束值", }, humidity_default_start: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "默认起始湿度", }, humidity_default_end: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "默认结束湿度", }, current_co2: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "当前co2含量", }, default_co2: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "默认的co2值", }, current_nh3: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "当前nh3含量", }, default_nh3: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "默认的nh3值", }, current_h2s: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "当前h2s含量", }, default_h2s: { type: DataTypes.STRING, allowNull: false, defaultValue: 0, comment: "默认的h2s值", }, coop_id: { type: DataTypes.INTEGER, allowNull: false, comment: "鸡舍id", }, }); // 强制同步数据库(创建数据表) // Control.sync({ force: true }); module.exports = Control;