const { DataTypes } = require("sequelize"); const seq = require("../db/seq"); // 鸡苗品种 const Device = seq.define("chicken_device", { // id 会被sequelize自动创建, 管理 egg_gathering: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: 0, comment: "急蛋设备开关", }, illumination: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: 0, comment: "光照开关", }, air_conditioner: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: 0, comment: "空调开关", }, coop_id: { type: DataTypes.INTEGER, allowNull: false, comment: "鸡舍id", }, }); // 强制同步数据库(创建数据表) // Device.sync({ force: true }); module.exports = Device;