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.
56 lines
1.4 KiB
56 lines
1.4 KiB
3 years ago
|
/* eslint-disable*/
|
||
|
'use strict';
|
||
|
|
||
|
module.exports = dc => {
|
||
|
const DataTypes = dc.ORM;
|
||
|
const sequelize = dc.orm;
|
||
|
const CameraAbilityBind = sequelize.define("cameraAbilityBind", {
|
||
|
id: {
|
||
|
type: DataTypes.INTEGER,
|
||
|
allowNull: false,
|
||
|
defaultValue: null,
|
||
|
comment: null,
|
||
|
primaryKey: true,
|
||
|
field: "id",
|
||
|
autoIncrement: true,
|
||
|
unique: "camera_ability_bind_id_uindex"
|
||
|
},
|
||
|
cameraId: {
|
||
|
type: DataTypes.INTEGER,
|
||
|
allowNull: false,
|
||
|
defaultValue: null,
|
||
|
comment: null,
|
||
|
primaryKey: false,
|
||
|
field: "camera_id",
|
||
|
autoIncrement: false,
|
||
|
references: {
|
||
|
key: "id",
|
||
|
model: "camera"
|
||
|
}
|
||
|
},
|
||
|
abilityId: {
|
||
|
type: DataTypes.INTEGER,
|
||
|
allowNull: false,
|
||
|
defaultValue: null,
|
||
|
comment: null,
|
||
|
primaryKey: false,
|
||
|
field: "ability_id",
|
||
|
autoIncrement: false,
|
||
|
references: {
|
||
|
key: "id",
|
||
|
model: "cameraAbility"
|
||
|
}
|
||
|
}
|
||
|
}, {
|
||
|
tableName: "camera_ability_bind",
|
||
|
comment: "",
|
||
|
indexes: []
|
||
|
});
|
||
|
dc.models.CameraAbilityBind = CameraAbilityBind;
|
||
|
|
||
|
const Camera = dc.models.Camera;
|
||
|
const CameraAbility = dc.models.CameraAbility;
|
||
|
Camera.belongsToMany(CameraAbility, { through: CameraAbilityBind, foreignKey: 'cameraId', otherKey: 'abilityId' });
|
||
|
|
||
|
return CameraAbilityBind;
|
||
|
};
|