mp/Database/model/IoTModel.js
2023-12-29 02:21:28 +08:00

80 lines
1.4 KiB
JavaScript

"use strict";
const { Sequelize, DataTypes } = require("sequelize");
const { sequelize } = require("../mySQL");
const IoTModel = sequelize.define("iot-data",{
// Model attributes are defined here
id: {
type: DataTypes.INTEGER,
allowNull: true,
primaryKey: true,
},
psiData: {
type: DataTypes.STRING,
allowNull: false,
length: 8,
},
humidityData: {
type: DataTypes.STRING,
allowNull: false,
length: 8,
},
o3Data: {
type: DataTypes.STRING,
allowNull: false,
length: 8,
},
no2Data: {
type: DataTypes.STRING,
allowNull: false,
length: 8,
},
so2Data: {
type: DataTypes.STRING,
allowNull: false,
length: 8,
},
coData: {
type: DataTypes.STRING,
allowNull: false,
length: 8,
},
temperatureData: {
type: DataTypes.STRING,
allowNull: false,
length: 8,
},
windspeedData: {
type: DataTypes.STRING,
allowNull: false,
length: 8,
},
currentTime: {
type: DataTypes.STRING,
allowNull: false,
length: 20,
},
regionData: {
type: DataTypes.STRING,
allowNull: false,
length: 10,
},
createdAt: {
type: DataTypes.DATE,
allowNull: true,
},
updatedAt: {
type: DataTypes.DATE,
//appointmentStart: { type: "DATETIME" } // Do this instead
allowNull: true,
},
},
{
timestamps: true,
}
);
module.exports = { IoTModel };