var SysUser = sequelize.import('../models/SysUser.js');
var MonitorSetting = sequelize.import('../models/MonitorSetting.js');
var Car = sequelize.import('../models/Car.js');
var Camera = sequelize.import('../models/Camera');
var Course = sequelize.import('../models/Course');
var Teacher = sequelize.import('../models/Teacher');
var TeacherToCourse = sequelize.import('../models/TeacherToCourse');
首先是一对一:
const Sequelize = require('sequelize');
module.exports = (sequelize, DataTypes) => {
const MonitorSetting = sequelize.define('MonitorSettings', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
autoIncrement: true
},
uId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'u_id'
},
username: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: ''
},
password: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: ''
},
salt: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: ''
},
equiNumber: {
type: DataTypes.STRING,
allowNull: false,
field: 'equi_number',
defaultValue: ''
},
ipAddress: {
type: DataTypes.STRING,
allowNull: false,
field: 'ip_address',
defaultValue: '127.0.0.1'
},
position: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: ''
},
stability: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
deployedAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: Sequelize.NOW,
field: 'deployed_at'
},
latitude: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: ''
},
longitude: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: ''
},
levelUpAddress: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: '',
field: 'level_up_address'
},
currentVersion: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: '',
field: 'current_version'
},
isDel: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
field: 'is_del'
}
}, {
timestamps: false,
underscored: true,
// paranoid: true,
freezeTableName: true,
tableName: 'Monito